$(document).ready(function(){ var page = window.location.hash; if(page != ""){ $('a[href='+ page +']').addclass('selected'); pageload(page.replace('#/page/', 'pages/?load=')); } $('#top a').click(function(event){ $('#top a').removeClass('selected'); $(this).addClass('selected'); pageload($(this).attr('href').replace('#/page/', 'pages/?load=')); event.preventDefault; }); });
<div id="top"> <a href="#/page/link">Link</a> <a href="#/page/link">Link</a> <a href="#/page/link">Link</a> <a href="#/page/link">Link</a> <a href="#/page/link">Link</a> </div>
Therefore, when I try to do this and load the page using window.location.hash, I get an error message in the console:
Search error: syntax error, unrecognized expression: [href = # / page / link]
How can I do this job?
thanks
Thew
source share