HTML <optgroup> tag
Examples
By <optgroup> tag of the related options together:
<select>
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
try it"
Browser Support
Most major browsers support <optgroup> tag.
Tag definitions and instructions
<Optgroup> tag is often used for the related options together.
If you have a lot of combinations of options, you can use <optgroup> tag can be very simple to related options together.
HTML 4.01 and HTML5 differences in
no.
Attributes
属性 | 值 | 描述 |
---|---|---|
disabled | disabled | 规定禁用该选项组。 |
label | text | 为选项组规定描述。 |
Global Properties
<optgroup> tag supports the global attributes, view complete the property sheet HTML Global Attributes .
Event Properties
<optgroup> tag supports all HTML event attributes .