Welcome Guest, Not a member yet? Register   Sign In
jquery add class failed when the page loaded
#1

[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
Code:
echo anchor tag
, i've used it, and nothing happens.
any typo maybe?




Theme © iAndrew 2016 - Forum software by © MyBB