diff --git a/horizontal-tabs/horizontal-tabs.js b/horizontal-tabs/horizontal-tabs.js
index 977e1b6..01e4992 100644
--- a/horizontal-tabs/horizontal-tabs.js
+++ b/horizontal-tabs/horizontal-tabs.js
@@ -52,7 +52,7 @@ Drupal.behaviors.horizontalTabs = {
         // element that matches the URL fragment, activate that tab.
         var hash = window.location.hash.replace(/[=%;,\/]/g, "");
         if (hash !== '#' && $(hash, this).length) {
-          tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane');
+          tab_focus = $(hash, this).closest('.horizontal-tabs-pane');
         }
         else {
           tab_focus = $('> .horizontal-tabs-pane:first', this);
