Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

HTML <optgroup> disabled Attribute

The disabled attribute on an <optgroup> tag disables the optgroup and its options.

The options appear dimmed and are not selectable.

Example

#

An <optgroup> element with a disabled attribute.
None of the options inside the first option group are selectable.

<select>
 <option value="">-- Select City --</option>
  <optgroup label="Europe" disabled>
    <option value="stockholm">Stockholm</option>
    <option value="barcelona">Barcelona</option>
    <option value="athens">Athens</option>
  </optgroup>
  <optgroup label="Asia">
    <option value="bangkok">Bangkok</option>
    <option value="manila">Manila</option>
    <option value="jakarta">Jakarta</option>
  </optgroup>
</select>

Using disabled

The disabled attribute specifies that the option group is disabled.

All of its child options are disabled and cannot be selected.


Syntax

<optgroup disabled>
or
<optgroup disabled="disabled">

Values

#

Value Description
disabled Use value 'disabled' or no value at all. Both are valid.

Browser support

Here is when disabled support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
8.0 Mar 2009
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <optgroup>
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

Guides