I have the following code in jQuery for adding class active to links in nav menu- jQuery
$('.main__menu li a').click(function(e){
$('.main__menu li a').removeClass("active");
$(this).addClass("active");
e.preventDefault();
});
but is not functioning, the code is adding active class but is not changing the html pages when clicking on a links because of e.preventDefault();
Has someone working code for this?
aelement relevant to the current page when the page itself is loaded.