I'm trying to add a class to an li
element once after button
is clicked.
The goal is to add the class one at a time with a delay time in between. It seems to work fine with the fadeOut
function but not with the addClass
or related function.
Here is a Jsfiddle.net demo http://jsfiddle.net/4ANCj/3/
and part of the code
$("button").click(function() {
$('li').each(function(index) {
$(this).delay(900*index).addClass("hi");
});
});
I know there is a similar question here on SO but it does not cut it.