HTML <select> disabled Attribute
Definition and Usage
disabled
The attribute is a boolean attribute.
When present, it specifies that the dropdown list should be disabled.
The disabled dropdown list is not available and cannot be clicked.
Can be set disabled
The disabled attribute is used to prevent users from using the dropdown list until other conditions are met (such as checking a checkbox, etc.). Then, JavaScript can remove the disabled value to make the dropdown list available.
Example
Disabled dropdown list:
<label for="cars">Please select a car brand:</label> <select name="cars" id="cars" disabled> <option value="audi">Audi</option> <option value="byd">BYD</option> <option value="geely">Geely</option> <option value="volvo">Volvo</option> </select>
Syntax
<select disabled>
Browser Support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 9.0 | Support | Support | Support |