I have problem with remove the attribute class="active" in tag li.
I have 2 class in tag <li>.
One is: active,
another one is: dropdown
but i just want to remove the previous class="active" and add this to the tag <li> when I clicked it.
But when I remove, the class="dropdown" also removed.
I know my code have problem but I dont know how to fix it.
Can anybody help me :)
Sorry, because my english not good :)
HTML
<ul class="nav nav-justified">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Projects</a></li>
<li><a href="#">Services</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Dropdown
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>Hoai Thy</li>
<li>My Huyen</li>
</ul>
</li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
Javascript
$(document).ready(function(){
$('.dropdown-toggle').dropdown()
$(".nav-justified li").each(function(){
$(this).click(function(){
$(".nav-justified li").removeAttr();
$(this).attr("class","active");
});
});
});