I am using jquery function which changes the class of element
$("a").click(function(){
$(this).closest("ul").find("a").parent().removeClass("active");
$(this).parent().addClass("active");
});
but when i refresh page, there are no changes added. How to remember them, even when user refreshes page? Thanks in advance.
You need to initialize your
activeitems using some type ofdata store(Cookies,Local Storage,QueryString). Though, there may be another/better solution if you give more context.Update based off comment:
Embed a hidden element in each tab that maps to a tab
classname orid. Then create a simple algorithm that matches the currently displayed tab content with the associated tab nav item.