Option group. Defines a group of option elements in a select form field.

The HTML <optgroup> tag is used for grouping related options within your select list. This makes it easier for users to comprehend the options when looking at a large list.

Required Attributes

  • label is used to assign a label to the option group.

Optional Attributes

  • disabled can be used to disable an element. It must be used in the format disabled="disabled".
  • Common attributes

Example

<select name="furniture">
	<optgroup label="Kitchen"> 
		<option>Chair</option>
		<option>Table</option>
	</optgroup>
	<optgroup label="Living"> 
		<option>Sofa</option>
		<option>TV</option>
	</optgroup>
</select>

Changes in HTML5

  • None.

Related Tags