I have created a toggle menu using this jQuery code. $(document).ready(function(){ var subs = $('.menu > ul ul'); subs.hide(); $('.menu > ul > li a').click(function(){ $(this).next('.menu > ul > li a').toggle(); }); });
A sample menu...... <ul class="menu"> <li class="title"><a href="#">Category One</a> <ul> <li class="item"><a href="../page1/index.html">Page1</a></li> <li class="item"><a href="../page2/index.html">Page2</a></li> <li class="item"><a href="../page3/index.html">Page3</a></li> </ul> </li> <li class="title"><a href="#">Category Two</a> <ul> <li class="item"><a href="../page1/index.html">Page1</a></li> <li class="item"><a href="../page2/index.html">Page2</a></li> <li class="item"><a href="../page3/index.html">Page3</a></li> <li class="item"><a href="../page4/index.html">Page4</a></li> </ul> </li> I want to increase the functionality of the menu by having each category close when a new one is selected, I also want an active category to stay open when a page is open that belongs to the category. any help would be appreciated thanks.