Option.value

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

							option.value

Description

The value property of the Option object specifies the value that is returned to the server when the option is selected and the form is submitted.

Example

Listing 7.412 shows an example of how the value property is used. The function getValue gets the value of the selected option.

Listing 7.412 Example of the value Property
 <html> <head> <title> Example of the text value of the option object</title> </head> <body> <script language="JavaScript"> <!--Hide // Function gets the value of the selected option function getValue(myForm){ for (var i = 0; i < document.form1.myList.length; i++) { if (document.form1.myList.options[i].selected == true) { alert("The ...

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.