how to loop through menu and remove class and then add class to current menu item
Posted
by Jonathan Lyon
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan Lyon
Published on 2010-03-14T06:45:58Z
Indexed on
2010/03/14
6:55 UTC
Read the original article
Hit count: 767
Hi all
I have this menu structure that is used to navigate through content slider panels.
<div id="menu">
<ul>
<li><a href="#1" class="cross-link highlight">Bliss Fine Foods</a></li>
<li><a href="#2" class="cross-link">Menus</a></li>
<li><a href="#3" class="cross-link">Wines</a></li>
<li><a href="#4" class="cross-link">News</a></li>
<li><a href="#5" class="cross-link">Contact Us</a></li>
</ul>
</div>
I would like to loop through these elements and remove the highlight class and then add the highlight class to the current / last clicked menu item.
Any ideas? Any help would be greatly appreciated.
Thanks
Jonathan
© Stack Overflow or respective owner