The disabled attribute is used to make a <select> dropdown inactive and unclickable. Users cannot select or change options from a disabled dropdown.
- Prevents users from interacting with the dropdown menu.
- Disabled <select> elements cannot be clicked or modified.
- It is a boolean attribute, so its presence alone disables the element.
Syntax:
<select disabled>option values...</select><!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>HTML select disabled Attribute</title>
</head>
<!--Driver Code Ends-->
<body style = "text-align:center">
<h1 style = "color: green;">GeeksforGeeks</h1>
<h2>HTML select disabled Attribute</h2>
<p>This select field is disabled.</p>
<!--A disabled select-->
<select disabled>
<option value="binary">Binary Search</option>
<option value="linear">Linear Search</option>
<option value="interpolation">Interpolation Search</option>
</select>
</body>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->