[eluser]Unknown[/eluser]
hello CI's masters, i wonder why when i'm adding a class to a li tag using jquery, the class only appears just a while and then gone. here's my code.
the JS
Code:
$(document).ready(function() {
$("ul.tab li").click(function() {
$("ul.tab li").removeClass("active"); //Remove the active class
$(this).addClass("active"); //Add the active tab to the selected tab
});
});
the HTML
Code:
<ul class="tab">
<li class="active nap"></li>
<li class="nap"></li>
<li class="nap"></li>
<li class="nap"></li>
<li class="nap"></li>
</ul>
if you argue that why i'm not using
, i've used it, and nothing happens.
any typo maybe?