|
|
Javascript selectedIndex value - Javascript
|
Views : 1665
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Javascript selectedIndex value:
Normal document.getElementById('selectbox id').selectedIndex returns only the index value of the options in selectbox.
To return selected index's value, we can use "document.formname.fieldname.value". In some cases it wont work in IE.
Hence use this method to return selectedIndex value which works both in firefox and ie,
var selectboxvalue = document.formname.fieldname.options[document.formname.fieldname.selectedIndex].text;
Variable "selectboxvalue" returns the selected index's value.
|
|
By Ramya, On - 2009-10-15 |
|
|
|