Warning:
This wiki has been archived and is now read-only.
Elements/optgroup
From HTML Wiki
< Elements
<optgroup>
The <optgroup> element represents a group of option elements with a common label.
Point
- The label attribute must be specified. [Example A]
HTML Attributes
disabled= boolean
if present, disable a group of option elements together.
label= string
Its value gives the name of the group, for the purposes of the user interface.
See global attributes.
Examples
Example A
[try it]:
<form action="courseselector.dll" method="get">
<p>Which course would you like to watch today?
<p><label>Course:
<select name="c">
<optgroup label="8.01 Physics I: Classical Mechanics">
<option value="8.01.1">Lecture 01: Powers of Ten</option>
<option value="8.01.2">Lecture 02: 1D Kinematics</option>
<option value="8.01.3">Lecture 03: Vectors</option>
</optgroup>
<optgroup label="8.02 Electricity and Magnestism">
<option value="8.02.1">Lecture 01: What holds our world together?</option>
<option value="8.02.2">Lecture 02: Electric Field</option>
<option value="8.02.3">Lecture 03: Electric Flux</option>
</optgroup>
<optgroup label="8.03 Physics III: Vibrations and Waves">
<option value="8.03.1">Lecture 01: Periodic Phenomenon</option>
<option value="8.03.2">Lecture 02: Beats</option>
<option value="8.03.3">Lecture 03: Forced Oscillations with Damping</option>
</optgroup>
</select>
</label>
<p><input type=submit value="▶ Play">
</form>
HTML Reference
The HTML5 specification defines the <optgroup> element in 4.10.11 The optgroup element.