HTML <optgroup> Tag with the 'disabled' Attribute

<select name="Food">
<optgroup label="Fruit">
<option value ="apples">Apples</option>
<option value ="bananas">Bananas</option>
<option value ="oranges">Oranges</option>
</optgroup>
<optgroup label="Vegetables" disabled>
<option value ="cabbage">Cabbage</option>
<option value ="carrots">Carrots</option>
<option value ="potatoes">Potatoes</option>
</optgroup>
<optgroup label="Meat">
<option value ="beef">Beef</option>
<option value ="chicken">Chicken</option>
<option value ="pork">Pork</option>
</optgroup>
</select>

The above example demonstrates usage of the disabled attribute when using the <optgroup> element. In this example, the Vegetables group has been disabled by using the disabled attribute.

The disabled attribute can be used to disable an <optgroup> element. Adding this attribute disables that group of <option> elements. This form control won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.

Boolean Attribute

The disabled attribute is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either disabled or disabled="disabled").

Possible values:

  • [Empty string]
  • disabled