I simply try to assign a background color to each div. it looks simple but it doesn't work.
var divElements = $("div");
var colorArray =["444", "344", "345", "472", "837", "043", "345", "472", "837", "043"];
for (var i=0; i< divElements.length; i++){
divElements[i].css("background","#"+colorArray[i])
}
I also tried to use jQuery's each
$("div").each(function(i) {
divElements[i].css("background","#"+colorArray[i])
})
How do code this in javaScript generic "for loop" and jQuerys .each()