I have a select element which has several items. I want to change the color of its first item, but it seems the color only shows when you click on the select dropdown. What
You can do this by using CSS: JSFiddle
HTML:
Text 1 Text 2 Text 3
CSS:
select option:first-child { color:red; }
Or if you absolutely need to use JavaScript (not adviced for this): JSFiddle
JavaScript:
$(function() { $("select option:first-child").addClass("highlight"); });
.highlight { color:red; }