diff --git a/misc/vertical-tabs.js b/misc/vertical-tabs.js index 3aa0f6f9ec2..e7fc4518644 100644 --- a/misc/vertical-tabs.js +++ b/misc/vertical-tabs.js @@ -50,8 +50,11 @@ Drupal.behaviors.verticalTabs = { if (!tab_focus) { // If the current URL has a fragment and one of the tabs contains an // element that matches the URL fragment, activate that tab. - if (window.location.hash && $(this).find(window.location.hash).length) { - tab_focus = $(this).find(window.location.hash).closest('.vertical-tabs-pane'); + + // Remove any characters that jquery does not accept in find(). + var hash = window.location.hash.replace(/[=%;,\/]/g, ""); + if (hash !== '#' && $(this).find(hash).length) { + tab_focus = $(this).find(hash).closest('.vertical-tabs-pane'); } else { tab_focus = $('> .vertical-tabs-pane:first', this);