var lawls = 1; $('#next').click(function () { $('.item').hide(); $('.item:eq(lawls)').fadeIn(); ++lawls; });
I have multiple divs, that I would like to sequentially appear when a button is clicked. My current code isn't working. This will work: $('#next').click(function () { $('.item').hide(); $('.item:eq(2)').fadeIn(); }); ...but obviously it's not dynamic, and won't cycle through the divs. Help!