How do I set an un-selectable default description in a select (drop-down) menu in HTML?

RSM picture RSM · Mar 6, 2011 · Viewed 175.8k times · Source

I have a drop down where the user selects a language:

<select>
    <option>English</option>
    <option>Spanish</option>
</select>
  1. I want the default option that is initially displayed to say "Select a language" instead of "English" (my first option, displayed by default).
  2. I don't want the user to be able to select "Select a language".

Answer

Glen Selle picture Glen Selle · May 13, 2013

Building on Oded's answer, you could also set the default option but not make it a selectable option if it's just dummy text. For example you could do:

<option selected="selected" disabled="disabled">Select a language</option>

This would show "Select a language" before the user clicks the select box but the user wouldn't be able to select it because of the disabled attribute.