Home › Forums › JavaScript › jQuery Show/Hide and looping trouble › Re: jQuery Show/Hide and looping trouble
July 29, 2011 at 1:37 am
#84199
jamygolden
Member
I’m very sure jsfiddle isn’t working correctly for me lol. Anyway, this will add ‘current’ to the #nav li’s
$(document).ready(function(){
$('#nav').children().click(function(){
$(this).addClass('current').siblings().removeClass('current');
$('#list').children().eq($(this).index()).show().siblings().hide();
});
});