In this section, we will learn what the disabled attribute is in HTML <select> element and how to use it.
What is disabled Attribute in HTML <select> Tag?
The disabled attribute, as the name suggests, is used when we want to disable the target <select> element so that users can’t use that dropdown list.
Note: when applying this attribute, the dropdown list still gets rendered on the page, but users can’t play with that list anymore.
We mainly use this attribute when we want to let users to know there’s a dropdown list in the document but for a temporary reason the list is not accessible.
HTML disabled Attribute in <select> Tag Syntax:
<select name = “name” disabled> </select>
<select> Tag disabled Attribute Values
The disabled attribute does not need a value. Simply put, this attribute in the opening tag of an HTML <select> element and that list becomes disabled.
Example: using disabled attribute in HTML <select> tag
See the Pen using disabled attribute in HTML <select> tag by Omid Dehghan (@odehghan) on CodePen.