HTML Optgroup tag


Group together related options with <optgroup> tags:
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>

Definition and Usage

The <optgroup> tag is used to group together related options in a select list.
If you have a long list of options, groups of related options are easier to handle for the user.

Browser Support

The <optgroup> tag is supported in all major browsers.

Differences Between HTML and XHTML


Required Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
label text Specifies a description for a group of options STF

Optional Attributes

Attribute Value Description DTD
disabled disabled Specifies that an option group should be disabled STF

Standard Attributes

id, class, title, style, dir, lang, xml:lang, tabindex

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
HTML Optgroup tag Reviewed by 1000sourcecodes on 21:38 Rating: 5
Powered by Blogger.