Jquery click behaviour
- by VP
I'm developing a menu. This menu, will change the background image when you click on a link, as almost all menus does. if i click in one link from the menu, this link backgroun will change the color.
My jquery script is:
$(function() {
$('#menu ul li').click(function() {
$('#menu ul li').removeClass("current_page_item");
$(this).addClass("current_page_item");
//return false;
});
});
today, with the "return false" commented, when i click on the link under "#menu ul li" it changes the background open the new page and the background is reseted. For sure, if i uncomment the return false, the background works fine but then i cannot open any link. So its looks like after that i open a new page, it reset the classes. How can i make it persistent?