Option.defaultSelected

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+ Syntax

							option.defaultSelected

Description

The defaultSelected property of the Option object specifies the initial option selection of the select list.

Example

Listing 7.409 shows an example of how the defaultSelected property is used. The check function checks for the default selected option.

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

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.