HTML <option> Tag

HTML <option> Tag

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

<option> Tag

Option tag <option> is used to defines an option in a select list.

Note : The <option> tag can be used inside a <select>, <optgroup>, or <datalist> tag.




<!DOCTYPE html>
    <title>Option 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
selected selected It defines the default option to be selected when page loads
value text It specifies the value of the option to be sent to the server

Global Attribute

Option Tag support all the global attributes of HTML.

Event Attribute

Option Tag support all the event attributes of HTML.

Next Tutorial

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

Keep Learning : )

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

- Related Topics