On Jun 14, 6:08 pm, Touran <oliverdav...@gmail.com> wrote: > I really need a way to change the pathclass based on selecting a item > in the menu without going back to the server. Any ideas. > Thanks
Hello, You could create a function which removes the 'current' class from all li elements in the menu then adds it to all li elements that are parents of the link that has been clicked. Call this function from within a link's click handler and be sure to add 'return false;' as the last line of that event handler if you don't want the link to be followed (it sounds like this is what you require). Something like this (very rushed and untested): /* change which elements have the 'current' class... */ function updatePathClass(clickedLink) { $('#nav li.current').removeClass('current'); $(clickedLink).parents('li').addClass('current'); } /* call that from within the links' click event handler... */ $('#nav a').bind('click',function(){ updatePathClass(this); /* code for other click actions here */ return false; }); Hope this helps. Joel Birch.