I\'m trying to remove and set an active class for a list item every time it\'s clicked. It\'s currently removing the selected active class but isn\'t setting it. Any idea w
I used this:
$('.nav-list li.active').removeClass('active');
$(this).parent().addClass('active');
Since the active class is in the element and what is clicked is the element, the first line removes .active from all and the second one (again, $(this) represents which is the clicked element) adds .active to the direct parent, which is .