I have a select
element and am using the first option
as the title of the select field. I am wondering if there is a way to gray out the text inside the select
field when the first option is selected. Can this only be done in JS, or is there a CSS solution?
I have tried changing the style of the first option
but that only changes the colour of the text when I activate the dropdown menu.
<select>
<option>Please select your favourite fruit</option>
<option>Apple</option>
<option>Banana</option>
</select>
question from:https://stackoverflow.com/questions/13694271/modify-select-so-only-the-first-one-is-gray