There is a similar list:
<ul class="menu"> <li><a href="/about">About Me</a> <ul> <li><a href="/user/cv">CV</a></li> <li><a href="/user/photo">Photo</a></li> <li><a href="/user/messages">Messages</a></li> </ul> </li> <li><a href="/settings">Messages</a></li> </ul> Using jquery (or js) you need to find the link of the page at the moment and select it.
The problem is that this code:
$(function () { $('li a').each(function () { var link = window.location.href; $("a[href='+ link +']").css('font-weight', 'bold') }); }); The code does not work, because returns an absolute address like test.com/user/cv
Question: somehow cut the link to a relative and pass as a variable in the search?
Another way is possible, just please with explanations.