I am quite new here and to jQuery but I have searched the related questions in stackoverflow but none is solving my problem. I have this code:
Html:
<div class="menu">
<div class="menu-items">
<ul class="nav">
<li class="var_nav">
<a href="../home.php">Home</a>
</li>
<li class="var_nav">
<a href="../portfolio.php">Porfolio</a>
</li>
<li class="var_nav">
<a href="../dashboard.php">Dashboard</a>
</li>
<li class="var_nav">
<a href="../users.php">Users</a>
</li>
</ul>
</div>
</div>
CSS
.nav li.active {
background-color: #048abb;
}
.nav li.active a {
color: #fff;
}
I want to apply class .active to the clicked(current/active) link so that the css can take effect. Any suggestions on how to apply the class to obove html code via jQuery?