Javatpoint Logo
Javatpoint Logo

HTML <optgroup> tag

HTML <optgroup> tag is used to group related <options> in a drop down list within <select> element.

Using <optgroup> tag with <select> makes easier to access the dropdown list especially if list has large number of options.

Syntax

Following are some specifications about the HTML <optgroup> tag

Display Inline
Start tag/End tag Both Start and End tag
Usage Forms and Inputs

Example

Test it Now

Output:

HTML optgroup tag

Attribute:

Tag-specific attributes:

Attribute Value Description
disabled disabled If it is set then options of that optgroup will be disabled.
label text It defines the label for the group which will be displayed in the drop-down list. It is required attribute.

Global attribute:

HTML <optgroup> tag supports the global attributes in HTML

Event attribute:

HTML <optgroup> tag supports the event attributes in HTML.

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<optgroup>YesYesYesYesYes
Next TopicHTML option Tag




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA