The best HTML <select> tag Tutorial In 2024, In this tutorial you can learn Examples,Browser Support,Tag definitions and instructions,Tips and Notes,Differences between HTML 4.01 and HTML5,Attributes,Global Properties,Event Properties,related articles,
Create a select list with four options:
All major browsers support the <select> tag.
<Select> element is used to create a drop-down list.
<select> element in the <option> tag defines the list of available options.
Tip: <select> element is a form control can be used to accept user input in the form.
HTML5 adds some new properties.
New: HTML5 new property.
属性 | 值 | 描述 |
---|---|---|
autofocus New | autofocus | 规定在页面加载时下拉列表自动获得焦点。 |
disabled | disabled | 当该属性为 true 时,会禁用下拉列表。 |
form New | form_id | 定义 select 字段所属的一个或多个表单。 |
multiple | multiple | 当该属性为 true 时,可选择多个选项。 |
name | name | 定义下拉列表的名称。 |
required New | required | 规定用户在提交表单前必须选择一个下拉列表中的选项。 |
size | number | 规定下拉列表中可见选项的数目。 |
<select> tag supports HTML global properties .
<select> tag supports HTML event properties .
HTML DOM Reference Manual: the Select Object