Loading...
HTML <select> Tag

HTML <select> Tag

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


<select> Tag

Select tag <select> is used within a form for defining a select or drop-down list.

Syntax

<select>.........</select>

Example

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

Output


Specific Attribute

Attribute Value Description
autofocus autofocus It specifies that on page load the drop-down list should automatically get focus
disable disable It disable the input control. The button won't accept changes from the user. It also cannot recieve focus and will skipped when tabbing
form form_id It specifies one or more forms
multiple multiple It specifies that multiple items can be selected at a time
name name It is used to assign a name to the input control
required required It specifies that before submitting the form the user has select a value, else it won't proceed ahead
size number It is used to defines the number of visible items in the drop-down list

Global Attribute

Select Tag support all the global attributes of HTML.


Event Attribute

Select Tag support all the event attributes of HTML.


Next Tutorial

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

Keep Learning : )

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

- Related Topics