Here is a snippet of the code I am working with:
<div></div>
<button>
Go
</button>
div {
width: 50px;
height: 50px;
border: 1px solid #ccc;
}
var bgs = ['red', 'blue', 'yellow', 'green', 'black'];
$('button').click(function() {
for (var i = 0; i < bgs.length; i++) {
$('div').css('background-color', bgs[i]);
}
});
https://jsfiddle.net/e4jhwtyc/2/
I intend for the background color to quickly cycle through red, blue, yellow, green, and black whenever the Go button is clicked. However, all I see is the black color when the button is clicked. Can you spot what may be missing?