<optgroup> (Option Grouping)
This element specifies a grouping of items in a selection list defined by option elements so that the menu choices can be presented in a hierarchical menu or similar alternative fashion to improve access through nonvisual browsers.
Standard Syntax
<optgroup
class="class name(s)"</optgroup>
dir="ltr | rtl"
disabled="disabled"
id="unique alphanumeric identifier"
label="text description"
lang="language code"
style="style information"
title="advisory text">
option elements
Standard Event Attributes
onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
Element Specific Attributes
- disabled
- Occurrence of this attribute indicates that the enclosed set of options is disabled.
- label
- This attribute contains a short label that might be more appealing to use when the selection list is rendered as items in a hierarchy.
Example
Where would you like to go for your vacation?
<select name="vacation" id="vacation">
<option id="ch1" value="Hong Kong"> Hong Kong</option>
<optgroup label="South Pacific">
<option id="ch2" label="Australia" value="Australia">Australia</option>
<option id="ch3" label="Fiji" value="Fiji">Wakaya (Fiji Islands)</option>
<option id="ch4" value="New Zealand">New Zealand</option>
</optgroup>
<option id="ch5" value="home" selected="selected">Your backyard</option>
</select>
Compatibility
HTML 4, 4.01
XHTML 1.0, 1.1
Internet Explorer 6
Netscape 6, 7
Opera 7
Notes
This element should occur only within the context of a select element.
Only the most modern browsers present this element in a visually meaningful fashion.