I'm new to JQuery
, I know this question is already answered in other posts but please help me on this,
How can i change the class of <li>
tag if a link <a>
is clicked?
<li class="link" id="home" >
<a href="admin?main=home">Home</a>
</li>
<li class="link" id="flt" >
<a href="admin?main=flt">FLT</a>
</li>
This is what i have tried so far:
$('li').click(function() {
$("li.active").removeClass("active");
$(this).addClass('active');
});
Please explain me the answer, other posts that is similar to mine doesn't have that much detail so i really don't understand how they do that?