Select.selectedIndex : Select : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » Select »

 

Select.selectedIndex








The selectedIndex property returns the index number of the selected option in that instance of a select box.

If this property is used to access a multiple select box, it will return the index number of the first selected item.












<html>
    <form name="myForm">
      <select name="mySelect" onChange='alert(mySelect.selectedIndex)'>
        <option value=A>AA</option>
        <option value=B>BB</option>
        <option value=C>CC</option>
        <option value=D>DD</option>
      </select>
    </form>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» Select