Skip to content Skip to sidebar Skip to footer

Jquery: Unrecognized Expression

$(document).ready(function(){ var page = window.location.hash; if(page != ''){ $('a[href='+ page +']').addclass('selected'); pageload(page.replace('#/page/

Solution 1:

Try this instead:

$('a[href="'+ page +'"]').addClass('selected');

(You need to escape the value of the href – with this, you get a[href="#/page/link"].)

Solution 2:

Your regular expression doesn't need the speech marks:

replace(#/page/, ...

Post a Comment for "Jquery: Unrecognized Expression"