Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Option value Property

Option value Property

Option Object Reference Option Object


Definition and Usage

The value property sets or returns the value of the option (the data is sent to the server when the form is submitted).

**Tip:** When the form is submitted, if this option is selected, the value is submitted together with the form.

Syntax

Set the value attribute:

optionObject.value=

"text"

Return the value attribute:

optionObject.value


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property.


Example

Example

Display the selected option value:

Runoob Tutorial(runoob.com)

Select your favorite fruit:

Try it »


Option Object Reference Option Object