In jQuery, how do you select the <a> which href is pointing to the current URL
For example:
URL = http://server/dir/script.aspx?id=1
I want to select this <a>
<a href='/dir/script.aspx'>...</a>
I tried this but it doesn’t work:
var url = window.location.href; $('#ulTopMenu a[''+url+''*=href]').addClass('selected');
Probably wrong syntax. Anyone know the right way of doing it?
Thanks in advance
Thanks Remy, it didn’t really work but it’s close.
Here is my final code