3 out of 8 rated this helpful - Rate this topic

optgroup element | optGroup object

[This documentation is preliminary and is subject to change.]

Allows authors to group choices logically in a select element.

HTML 4.01 Specification, Section 17.6

Standards information

HTML information

Closing Tagrequired
CSS Displayblock

DOM Information

Inheritance Hierarchy

 Node
  Element
   HTMLElement
     optGroup

Remarks

In HTML 4.01, all OPTGROUP elements must be specified directly within a SELECT element. Groups may not be nested.

You can add OPTGROUP elements only to a SELECT element located in the same window where the OPTGROUP elements are created.

This element is available in HTML as of Microsoft Internet Explorer 6.

Examples

The following example shows how to use the OPTGROUP element to create groups of items in a drop-down list box.


<SELECT>
    <OPTGROUP LABEL="Alkaline Metals">
        <OPTION>Lithium (Li)</OPTION>
        <OPTION>Sodium (Na)</OPTION>
        <OPTION>Potassium (K)</OPTION>
    </OPTGROUP>
    <OPTGROUP LABEL="Halogens">
        <OPTION>Fluorine (F)</OPTION>
        <OPTION>Chlorine (Cl)</OPTION>
        <OPTION>Bromine (Br)</OPTION>
    </OPTGROUP>        
</SELECT>

 

 

Build date: 3/8/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ