I have a drop down where the user selects a language:
<select> <option>English</option> <option>Spanish</option> </select>
disabled="" , disabled="false" , and just disabled all have the same effect.
Definition and Usage. The selected attribute is a boolean attribute. When present, it specifies that an option should be pre-selected when the page loads. The pre-selected option will be displayed first in the drop-down list.
To select multiple items, the user has to hold down the shift or ctrl key, then select with the mouse.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With