HTML <option> tag
Examples
Create a select list with four options:
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
try it"
Browser Support
Most major browsers support <option> tag.
Tag definitions and instructions
The <option> tag defines a drop-down list of options (one entry).
<option> tag contents as a <select> or <datalist> element to use.
Tips and Notes
NOTE: <option> tag may be the case without the use of any property, but you usually need to use the value property, which will be sent to the server indicates the content.
Note: Please select the element with the use of this label, otherwise the label is meaningless.
Tip: If you list a lot of options, you can use <optgroup> tag of the related options can be combined.
Attributes
属性 | 值 | 描述 |
---|---|---|
disabled | disabled | 规定此选项应在首次加载时被禁用。 |
label | text | 定义当使用 <optgroup> 时所使用的标注。 |
selected | selected | 规定选项(在首次显示在列表中时)表现为选中状态。 |
value | text | 定义送往服务器的选项值。 |
Global Properties
<option> tag supports the global attributes, view complete the property sheet HTML Global Attributes .
Event Properties
<option> tag supports all HTML event attributes .