I think you are trying to accomplish this:
Assuming you have an HTML page like this:
<html>
<body>
<h1>Hello World!</h1>
<div id="controls-wrapper>some text</div>
</body>
$(document).ready(function(){
var colors = ["#CCCCCC","#333333","#990099"];
var rand = Math.floor(Math.random()*colors.length);
$('#controls-wrapper').css("background-color", colors[rand]);
$('h1').css("color", colors[rand]);
});
After creating an array of colors, you will get a random number corresponding to the color index.
Now that you have a random index, you can use it to set the background or color of the text of the object.
, ,
rand = Math.floor(Math.random()*colors.length);
.
, , $('h1').css("color", colors[rand]);, H1 , , H1, $('h1.myclass').css("color", colors[rand]); $('#ID_for_my_H1').css("color", colors[rand]);