HTML optgroup tag
HTML

HTML optgroup tag

Mishel Shaji
Mishel Shaji

The HTML optgroup tag is used to group options within inside a <select> tag.

Attributes

AttributeDescriptiondisabledThis boolean attribute is used to specify ehether the element is disabled.labelUsed to specify a label for each groups.

Example

<select id="lang">
    <optgroup label="Compiled">
        <option>C</option>
        <option>C++</option>
        <option>C#</option>
    </optgroup>
    <optgroup label="Interpreted">
        <option>PHP</option>
        <option>JavaScript</option>
    </optgroup>
</select>

Output