Find if id of a link equals id of parent container

Posted by Robert Lawson on Stack Overflow See other posts from Stack Overflow or by Robert Lawson
Published on 2010-05-30T10:56:54Z Indexed on 2010/05/30 11:02 UTC
Read the original article Hit count: 292

Filed under:
|

Hi guys needing a bit of help.

I am creating a one page personal site.

Each section has a menu in it to jump to another section, however i want to have a class added to menu for the current section:

i.e. if you are in about the about link would have a class 'current'.

This is how it looks.

<section id="about">
<nav>
    <li><a href="#" id ="about">About</a></li>
    <li><a href="#" id ="contact">About</a></li>
    <li><a href="#" id ="blog">About</a></li>
</nav>

New to jquery so i am struggling to find out how to do this.

Any help will be greatly appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about selectors