HTML <option> valueAttribute

HTML option 标签参考手册HTML <option> Tag

Examples

Dropdown list in an HTML form:

<form action="demo_form.html">
<select name="cars">
<option value="volvo">Volvo XC90</option>
<option value="saab">Saab 95</option>
<option value="mercedes">Mercedes SLK</option>
<option value="audi">Audi TT</option>
</select>
<input type="submit" value="提交">
</form>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute.


Definition and Usage

The value attribute specifies the value sent to the server when the form is submitted.

The content between the opening tag <option> and the closing tag </option> is what the browser displays in the dropdown list, while the value in the value attribute is the value sent to the server when the form is submitted.

Note:If the value attribute is not specified, the option's value will be set to the content inside the <option> tag.


Differences Between HTML 4.01 and HTML5

None.


Syntax

<option value="value">

Attribute Values

Value Description
value The value sent to the server.


HTML option 标签参考手册HTML <option> Tag Other Extensions