How can I iterate through an array of Div IDs and change their CSS (background color) one after the other instead of all at once? I have tried looping through the array, but the CSS is applied simultaneously to all the divs. Any tips on how to delay the effect so that each div changes its color sequentially would be greatly appreciated.
$("#light").click(function(){
for (var i=0; i < randomArray.length; i++) {
$("#" + randomArray[i]).css("backgroundColor", "Black"); //Is there a way to change the colors one by one instead of all together?//
}
});