Javascript Reference
Categories: SELECT

javascript SELECT value

@June 13, 2008, 12:43 p.m.
value Firefox/Netscape/NN 6 IE 4 Chrome/Safari/DOM 1  

 

Read/Write  

This is the current value associated with the form control that is submitted with the name/value pair for the element. All values are strings, but they may represent other kinds of data, including Boolean and numeric values. For browsers earlier than IE 4 and Netscape 6, scripts must retrieve the selected option's value by using the select object's selectedIndex property as an index into the options array, then inspect each option object's selected property to find the true one(s).

 
Example
 
if (document.forms[0].medium.value == "CD-ROM") {
 ...
}
 
Value

String.

 
Default

None.

markup is your logic.
It is clear enough with HTML source as below.
<form>
<select name="medium">
<option>CD-ROM</option>
<option>DVD</option>
</select>
</form>
js - 2012-07-16
Why wouldn't you add the markup? This doesn't tell you anything.
Olivia - 2012-05-18

Powered by Linode.