The value attribute on an <option> tag sets the value of the option.
The value of the selected option is included during form submission.
A value attribute on <option> elements.
The selected value is sent during form submission.
<form action="/tutorial/action.html">
<fieldset>
<legend>Your location</legend>
<select name="country" style="width:220px;">
<option value="">-- Select a Country --</option>
<option value="us">United States</option>
<option value="uk">United Kingdom</option>
<option value="fr">France</option>
<option value="de">Germany</option>
</select><br/>
<input type="submit" value="Submit">
</fieldset>
</form>
The value attribute specifies the value of the <option>.
When a form is submitted, the parent <select> element sends the value of the selected option.
If the <option> has no value attribute, the option's content will be submitted instead.
<option value="value">
Value | Description |
---|---|
value | An alphanumeric string. |
Here is when value support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |