I have a menu that links to content on the same page and through jQuery fades div's in and out, working perfectly.
The first link in the navigation has a class attached to it (current_page_item) and I would like, on click of any other link in the navigation, to remove that class and add it to the clicked link.
So far I've tried something like:
- $(function() {
- $("#nav-links a").click(function(){
- $("#nav-links ul li").removeClass("current_page_item").find("li:last a").addClass("current_page_item");
- });
- });
which doesn't work.
I'm very new to javascript so any help would be appreciated.
Thanks!
EDIT: