s_p
s_p

Reputation: 4693

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

Upvotes: 4

Views: 5852

Answers (1)

j08691
j08691

Reputation: 207901

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

Upvotes: 9

Related Questions