HTML optgroup tag

An HTML optgroup tag is used to group options inside a select tag. It supports HTML global attributes.

HTML optgroup tag

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

Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to GeekInsta
Great! Next, complete checkout for full access to GeekInsta
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.