HTML select Tag
HTML select Tag
The select element is used to create a drop-down list. It is mostly used in form elements. The name attribute is required to reference the form data after the form is submitted. The id attribute is required to associate the drop-down list with a label. The option tags are used inside of select elements which basically are used to define available options in the drop-down list.
Attribute Explanation:-
Attribute | Value | Description |
---|---|---|
autofocus | autofocus | Specifies that drop-down list automatically get focus when page loads. |
disabled | disabled | Specifies that drop-down list be disabled. |
form | form_id | Defines which form drop-down list belongs to. |
multiple | multiple | Specifies that multiple options can be selected at once. |
name | name | Defines name for drop-down list. |
required | required | Specifies that user is required to select a value before submitting form. |
size | number | Defines number of visible options in a drop-down list. |
Syntax:-
Its syntax is:- < select >