HTML <optgroup> Tag

HTML <optgroup> Tag

In this tutorial, we will learn about optgroup tag in HTML with the help of examples.

<optgroup> Tag

Optgroup tag <optgroup> is used to group related options in a <select> tag and show them in the form of drop-down list.

Note : The <optgroup> tag make it easier for users to choose an option when there are large number of options.




<!DOCTYPE html>
    <title>Optgroup Tag</title>
      <optgroup label = "Computer Languages">
      <option value = "html">HTML</option>
      <option value = "css">CSS</option>
      <option value = "javascript">Javascript</option>


Specific Attribute

Attribute Value Description
disable disable It is used to disable the input control. The button won't accept changes from the user
label text It defines a label to use when using <optgroup> tag

Global Attribute

Optgroup Tag support all the global attributes of HTML.

Event Attribute

Optgroup Tag support all the event attributes of HTML.

Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <optgroup> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <option> Tag.

- Related Topics