I am trying to append different colors to some text:
var s = ["red", "green"];
for (i=0; i < s.length; i++) {
$(".colors").append("<span>TEXT </span>").css("color", s[i]);
}
The output of both spans is green, but my intention was that the first one is going to be red and only the second one green. What am I doing wrong?