Generate random hex colors in JavaScript/jQuery

The following source code will let you generate random hex colors in JavaScript/jQuery easily.

'#'+Math.floor(Math.random()*16777215).toString(16);

Demo: http://jsbin.com/tadori/1/

Leave a Reply

Your email address will not be published. Required fields are marked *