<ul class="nav">
<li>
<a href="/dashboard">
<i class="material-icons">dashboard</i>
<p>Dashboard</p>
</a>
</li>
<li>
<a href="profile">
<p>User Profile</p>
</a>
</li>
</ul>
Now what i want is if i click on one of this it will become active so what i did is-
$(document).ready(function() {
$('li').bind('click', function() {
$( this ).addClass('active');
});
});
but the problem is it has no applied class after loading the page so i want it applid after loading the page i also tried toggleClass
$('li').on('click', function() {
$(this).parent().toggleClass('active');
});
any Suggestoins.. thank you..