I have traffic light - 3 colors:
<div class="green" id="ready"></div>
<div class="orange" id="steady"></div>
<div class="red" id="go"></div>
and array:
var status = ["ready", "steady", "go"];
I want add and remove class (to imitate flashing) from each in infinity loop with some delay, but this code make it all in one time. How can i solve it?
jQuery.each(status, function() {
setTimeout(function() {
$("#" + this).addClass('active');
}, 3000);
});