Managing active state
javascript, jquery
Solution
$("li a").click( function() {
$(".active").removeClass("active");
$(this).parent("li").addClass("active");
});
Problem
``` <ul> <li><a href="#">item 1</a></li> <li><a href="#">item 2</a></li> <li><a href="#">item 3</a></li> </ul> ``` On click, I'd like to addclass `active` to the parent li element while also removing the `active` class from any other element which may be active already.