HTML - <select> Tag



The HTML <select> tag is used within a form for defining a select list.


<!DOCTYPE html>

      <title>HTML select Tag</title>

      <form action = "/cgi-bin/dropdown.cgi" method = "post">
         <select name = "dropdown">
            <option value = "Data Structures" selected>Data Structures</option>
            <option value = "Data Mining">Data Mining</option>
         <input type = "submit" value = "Submit" />


This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <select> tag also supports the following additional attributes −

Attribute Value Description
autofocus html-5 autofocus Specifies that on page load the drop-down list should automatically get focus.
disabled disabled Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
form html-5 form_id Specifies one or more forms.
multiple multiple When set, it specifies that multiple items can be selected at a time
name name Assigns a name to the input control.
required html-5 required Before submitting the form the user is required to select a value, else it won't proceed ahead.
size number Defines the number of visible items in the drop-down list

Event Attributes

This tag supports all the event attributes described in HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes