References

Collection of references for web development.

HTML optgroup tag

Description

The HTML <optgroup> element represents a group of options in a <select> element.

Attributes

Attribute Value Description
disabled boolean Specifies whether the element should be disabled or not (user is unable to click or control if disabled).
label string Specifies the name or meaning of the element.

Example

<select>
	<optgroup label="vegetables">
		<option>Carrots</option>
		<option>Potatoes</option>
		<option>Spinach</option>
	</optgroup> 
	<optgroup label="fruit">
		<option>Apples</option>
		<option>Bananas</option>
	</optgroup> 
</select>