Name

optgroup — <optgroup> . . . </optgroup>

Defines a logical group of options elements. Browsers could use optgroup elements to display hierarchical cascading menus. An optgroup element may not contain other optgroup elements (they may not be nested).

Attributes

Core (id, class, style, title ),Internationalization,Events

disabled="disabled"

Indicates that the group of options is nonfunctional. It can be reactivated with a script.

label="text"

Required. Specifies the label for the option group.

Example

<p>What are your favorite ice cream flavors?<p>
<select name="ice_cream" size="6" multiple="multiple">
<optgroup label="traditional">
   <option>Vanilla</option>
   <option>Chocolate</option>
</optgroup>
<optgroup label="specialty">
   <option>Inside-out Rocky Road</option>
   <option>Super-duper Praline Pecan Smashup</option>
</optgroup>
</select>

Get HTML and XHTML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.