HTML <optgroup> disabled attribute

Definition and Usage

disabled Property is a boolean property.

When present, it specifies that the option group should be disabled.

Disabled option groups are not available and cannot be clicked.

Can be set disabled The attribute is used to prevent the user from selecting the option group until certain other conditions are met (such as checking a checkbox, etc.). Then, JavaScript needs to be used to remove the disabled value to make the option group selectable.

Example

Disabled option group:

<label for="cars">Please select a car brand:</label>
<select name="cars" id="cars">
  <optgroup label="German Cars" disabled>
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

Try It Yourself

Syntax

<optgroup disabled>

Browser Support

The numbers in the table indicate the first browser version to fully support this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 8.0 Support Support Support