Hello everyone!
I'm trying to change element's background-color using random colors from an array. There is the code:
$(document).ready(function(){
var randomColors = ['#00eeff','#fcff00','#9600ff'];
var rndNum = Math.floor(Math.random() * randomColors.length);
$("div.anyclass").hover(
function() {
$(this).css({'background-color' : 'randomColors[rndNum]'})
},
function() {
$(this).css({'background-color' : '#fff'});
});
});
So, it doesn't work, where is the problem?