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

HTML DOM Option text Property

Option text Property

Option Object Reference Option Object


Definition and Usage

The text property sets or returns the text value of the option.

Tip: This property sets or returns the plain text contained in

Syntax

Set the text property:

optionObject.text=

"text"

Return the text property:

optionObject.text


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the text property


Example

Example

The following example returns the text of all options in the dropdown list:

Runoob Tutorial(runoob.com)

Select your favorite fruit:

Try it »


More examples

Output the text of all options in the dropdown list


Option Object Reference Option Object