$(document).ready(function(){ var page = window.location.hash; if(page != \"\"){ $(\'a[href=\'+ page +\']\').addclass(\'selected\'); pageloa
Your regular expression doesn't need the speech marks:
replace(#/page/, ...
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"].)
href
a[href="#/page/link"]