Option.text

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+ Syntax

							option.text

Description

The text property of the Option object specifies the text for the selected option of the select list.

Example

Listing 7.411 shows an example of how the text property is used. The check function determines what the text is for the selected value.

Listing 7.411 Example of the text Property
 <html> <head> <title> Example of the text property of the option object</title> </head> <body> <script <script language="JavaScript"> <!--Hide // function check the form to see what the selected value's text is function check(myForm){ for (var i = 0; i < document.form1.myList.length; i++) { if (document.form1.myList.options[i].selected == true) { alert("The selected ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.