diff --git a/wp-content/themes/twentyfourteen/js/functions.js b/wp-content/themes/twentyfourteen/js/functions.js index ea656d8077..3ec30fef0b 100644 --- a/wp-content/themes/twentyfourteen/js/functions.js +++ b/wp-content/themes/twentyfourteen/js/functions.js @@ -40,7 +40,13 @@ * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ */ _window.on( 'hashchange.twentyfourteen', function() { - var element = document.getElementById( location.hash.substring( 1 ) ); + var hash = location.hash.substring( 1 ), element; + + if ( ! hash ) { + return; + } + + element = document.getElementById( hash ); if ( element ) { if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {