HTML - <optgroup> Tag



The HTML <optgroup> tag is used for grouping related options within your select list. This makes it easier for users to comprehend their choices when looking at a large list.


<!DOCTYPE html>

      <title>HTML optgroup Tag</title>

         <optgroup label = "India">
            <option value = "mumbai">Mumbai</option>
            <option value = "delhi">Delhi</option>
         <optgroup label = "USA">
            <option value = "florida">Florida</option>
            <option value = "newyork">New York</option>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <optgroup> tag also supports the following additional attributes −

Attribute Value Description
disabled disabled Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
label text Defines a label to use when using <optgroup>.

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes