This adds the class to a li. When another li is clicked it also adds the class current. But now i have two current. You’ll notice below im trying to remove the class current from the li which was initially current.
var
$tabs = $('.promo-tabs li'),
$panes = $('.promo-panes > div');
$tabs.click(function(){
$(this).addClass('current')
$(this).parent().siblings().find('li').removeClass('current');
$panes.eq($tabs.index(this)).fadeIn().siblings().hide();
return false;
});
//Init Promo Tabs
$tabs.first().click();
Any ideas on how to tweak this line so the class is removed once another li is clicked would be great
$(this).parent().siblings().find('li').removeClass('current');
Why not just
placed before
? In other words, just get rid of “current” from all the
<li>elements, and then add it to the one that’s been clicked.