From W3C Wiki
< HTML‎ | Elements
Jump to: navigation, search


The <optgroup> element represents a group of option elements with a common label.


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.


Example A

[try it]:

<form action="courseselector.dll" method="get">
  <p>Which course would you like to watch today?
    <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 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 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>
  <p><input type=submit value="▶ Play">

HTML Reference

The HTML5 specification defines the <optgroup> element in 4.10.11 The optgroup element.