Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

display disabled option element - html drop down form

I have a drop down html form and would like to display the disabled=disabled element (view the edit below)
At first initial glance, the form skips the disabled element and displays "option 1".

<select>
    <option disabled='disabled'>Title</option>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
</select>

Is this possible with just html or css?
If not then how about jQuery or javascript?

Edit
Would like the form to look like this
enter image description here

Currently it looks like
enter image description here

like image 396
t q Avatar asked Jan 15 '23 08:01

t q


1 Answers

Add selected="selected" to your first option.

<select>
    <option selected="selected" disabled='disabled'>Visible Title</option>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
</select>

jsFiddle example

like image 91
j08691 Avatar answered Jan 16 '23 21:01

j08691