Skip navigation

<label>Combo box: </label>
<select name="selState" id="selState">
   <option value="TN">Tamilnadu</option>
   <option value="AP">AndraPradesh</option>
</select>
document.forms[0].selState.options[0]  //<option value="TN">
document.forms[0].selState.options[0].getAttribute("value")  //"TN"
document.forms[0].selState.options[0].firstChild.nodeValue  //"Tamilnadu"
document.forms[0].selState.options[0].text  //Tamilnadu
document.forms[0].selState.options[0].value   //TN
document.forms[0].selState.options[1].index   //1
document.forms[0].selState.options.length   //2
document.forms[0].selState.selectedIndex   //index of currently selected option
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: