Advertisement
Home Open Editor ❯

HTML <option> value Attribute

Example

<form action="action.php">
<label for="lang">Choose a language:</label>

<select id="lang" name="lang">
  <option value="HTML">HTML</option>
  <option value="CSS">CSS</option>
  <option value="JavaScript">JavaScript</option>
</select>

<input type="submit" value="Submit">
</form>

Try this code ❯

Meaning

The value attribute specifies the value to be included with the form result when the item is selected.

The value sent when the form is submitted if the option has been selected in the dropdown list.

Note: If the value attribute is omitted, the content will be passed as a value instead.


Standard Syntax

<option value="text">text</option>


Advertisement

Attribute Values

Value Description
text Specifies the textContent of the element.
Home Open Editor ❯
Advertisement