Javascript Reference
Categories: OPTION

javascript OPTION selected

@March 15, 2008, 1:22 a.m.
selectedFirefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM 1  

Read/Write  

Determines whether the list option has been selected by the user, meaning that its value is submitted with the form. Scripts can modify the value to select an item algorithmically. To find out which option is selected, it is more efficient to use the select object's selectedIndex property, rather than looping through all options in search of those whose selected properties are true. The exception to this is when the select element is set to allow multiple selections, in which case you need to cycle through them all to find the chosen items.

 
Example
 
document.forms[0].selectList.options[3].selected = true;
 
Value

Boolean value: true | false.

 
Default

false


Powered by Linode.