Wednesday, June 30, 2010

Jscipt for Color Picklist Color

Changing the color of a single option in a picklist

You can change the color and background color of an option element using the following syntax:

//TODO: Replace with the schema name of the picklist in question.
var list = crmForm.all.;

//using the first option here, you need to find the one you need.
var option = list.options[0];

//Set the background color to red.
option.style.backgroundColor = "#FF0000";

//Set the text color to white.
option.style.color = "#FFFFFF";

No comments: