JavaScript Coder

javascript get select

How to get the value of a form element : Drop downs and lists

This article is in continuation of getting form element values using JavaScript series. Drop down list We can obtain a reference to this type of element using its name: oSelectOne = oForm.elements["select_one_element_name"]; To get the index of the selected option in the JavaScript options array of the select element, we can use the selectedIndex property of the select element object: index = oSelectOne.selectedIndex; We can now use this index to determine the value of the selected option:

Continue Reading →