Color Picker

by Hifni Nazeer

HTML

<div id="container"></div>

JavaScript

function loadColors(){
    var htmlx = '';
    
    for (i=0;i<10;i++)
    {
    	htmlx = htmlx + '<div style="background-color: 		'+getRandomColor() +';">'+ getRandomColor() +'</div>';
    }
    
    return htmlx;
}

function getRandomColor() {
    var letters = '0123456789ABCDEF'.split('');
    var color = '#';
    for (var i = 0; i < 6; i++ ) {
        color += letters[Math.floor(Math.random() * 16)];
    }
    return color;
}



$(document).ready(function(){
	var htmlx = loadColors();
    alert(htmlx);
    
    $('#container').html(htmlx);
});