This <select> tag creates a drop-down or pick list. The options displayed on the list are created by using the <option> element.
<select> |
Yes | Yes | Yes | Yes | Yes |
HTML5 has added some new attributes.
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | Set to autofocus the drop-down list when the page loads |
disabled | disabled | disable drop-down list |
form | form_id | Set one or more owner forms |
multiple | multiple | Set that multiple options can be selected at once |
name | name | Defines a name for the drop-down list |
required | required | Mark the select element as required |
size | number | Set the number of visible options in a drop-down list |
The <select> tag supports the Global Attributes in HTML.
The <select> tag supports the Event Attributes in HTML.
None.
A demo showing how to use <select> tag.
<html>
<body>
<form>
<select name="select1">
<optgroup label="First Group">
<option>First</option>
<option>second</option>
<option>third</option>
</optgroup>
</select>
</form>
</body><!-- w w w. j a va 2 s .com-->
</html>