Try this:
$("ul li").on("click", function() {
$("li").removeClass("active");
$(this).addClass("active");
});
You will have to play around with it with your given tags. What helped me was declaring this to become active, then removing the active class.