HTML Dog

Skip to navigation

HTML Tag: optgroup

Option group in a selection form control (select). Used to group together option elements.

Required Attributes

Attribute Description Possible values
label A user-visible name for the group. Text.

Optional Attributes

Attribute Description Possible values
disabled Renders the options within the option group non-selectable. None.
Global attributes

Example


<form action="catsndogs.php">
    <select name="catordog">
        <optgroup label="Cats">
            <option>Tiger</option>
            <option>Leopard</option>
            <option>Lynx</option>
        </optgroup>
        <optgroup label="Dogs">
            <option>Grey Wolf</option>
            <option>Red Fox</option>
            <option>Fennec</option>
        </optgroup>
    </select>
    <input type="submit">
</form>