There is my script: https://jsfiddle.net/hcsofjaa/1/ I want to change color of these cells every 2000ms one by one, but It seems the setTimeout function does not work properly. Does anybody know, where is the problem?
$("#button").click(function(){
for (var i = $("span").length; i > 0; i--) {
setTimeout(function(){
$("span:nth-child("+i+")").css("background-color","blue");
}, 2000);
}