Thursday, September 2, 2010

jQuery Random Color

This is a simple example of how to assign a random color to any html element:

$(this).css("color", 'rgb('+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+')');

No comments:

Post a Comment