2
How do I add a title to select
that it appears in the options and disappears when selecting?
I know it looks like a duplicate, but the problem is I haven’t found what I’d like exactly, option selected disabled
works but does not fulfill what I want. Using the same example I saw here on stackoverflow with selected disabled
:
<select>
<option disabled selected>- Selecione -</option>
<option>Volvo</option>
<option>Mercedes Bens</option>
</select>
However, what I would like to do is that the title "- Select -" become the property placeholder
and when I went to select the field "- Select -" the same did not appear in the options and disappear. So:
I was able to "hide" the options with disabled but it didn’t have the same effect as your print, for the default option. See if it helps you:
select:focus > option:disabled {display:none;}
– Caique Romero