I have been working on a function to change the color of a span dynamically from black to a randomly selected color from a predefined list. However, I am encountering an issue with the .css("color", variableName) part of my code and suspect that my syntax might be incorrect. ( http://jsfiddle.net/crismanNoble/8gM76/ )
$(".randomRoll")
.mouseover(function() {
var colors = ["6F216C", "F34B0D", "C50102", "5DA537", "F1D81B"];
var pick = Math.floor(Math.random()*5);
var colorN = colors[pick];
$(this).css("color", colorN);
//alert(colorN);
})
.mouseout(function() {
$(this).css('color','black');
});