select element
<Select>
Explanation
Select element is used to create drop down list box.
<select>
<option value="Text">Text</option>
</select>
Element Specific attributes supported by this element are:
| Attribute | Value | Description |
| autofocus | autofocus | When webpage loads, the drop down list must automatically get focus. |
| disabled | disabled | Indicates that the drop down list must be disabled. |
| form | form_id | Illustrates the forms, which belongs to select field. |
| multiple | multiple | Enables user to pick multiple items at once. |
| name | text | Fixes name for the drop down list. |
| size | number | Specifies the total number of visible options in drop down list. |
Example Code:
Result :
Who is the captain of Real Madrid?
- It acts as the intercative element as it helps to acquire inputs from user.
- <Option> must be used inside <select> to create choices/option list.
- User can create unlimited options of his/her choice.
It is available in the previous versions of HTML.
It supports both
Global Attributes and
Event Attributes in HTML5.
Limitations:
It is applicable to all major browsers.