I have two methods to select an li with class and remove that class, find next li and add the class to it
method 1:
$nxt=$(".current");
$(".current").removeClass("current");
$nxt.next().addClass("current");
method 2:
$('.current').removeClass(function(){
$(this).next().addClass('current');
return 'current';
}
I want to use the second one but unfortunately,it doesn’t work for me!
Plz help me
Are you just missing a closing bracket?
It appears to work here – http://jsfiddle.net/ujTDp/