diff --git a/html/js/sorttable.js b/html/js/sorttable.js
index e90e6cf03..a15b1ad33 100644
--- a/html/js/sorttable.js
+++ b/html/js/sorttable.js
@@ -277,8 +277,8 @@ var sorttable = {
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
-
- if (node.getAttribute("sorttable_customkey") != null) {
+
+ if (node.getAttribute && node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
} else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, '');