How to disable the drop-down list in HTML5 ?
The drop-down is used to create a list of items that need to select an element. We use <select> and <option> elements to create a drop-down list and use disabled attribute in <select> element to disable the drop-down list element. A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.
Syntax:
<select disabled> Option values... </select>
Attribute Value:
- disabled: The <select> disabled attribute is used to specify the select element is disabled. A disabled drop-down list is un-clickable and unusable. It is a boolean attribute.
Example:
HTML
<!DOCTYPE html> < html > < head > < title > How to disabled drop-down list in HTML5? </ title > </ head > < body style = "text-align: center;" > < h1 style = "color: green;" > GeeksforGeeks </ h1 > < h3 > How to disabled drop-down list in HTML5? </ h3 > < select disabled> < option value = "c" >C</ option > < option value = "cpp" >C++</ option > < option value = "java" >Java</ option > < option value = "python" >Python</ option > </ select > </ body > </ html > |
Output:
Please Login to comment...