Friday, May 28, 2010

How to get the selected values of dropdown (combobox) using JavaScript?

The selected values of a dropdown (combobox) can be accessed by the values and text property of a dropdown’s (combobox) option object.

The option object has the following properties.

defaultSelected          Refers to the option that is selected by
                                 default from the select box.

index                         Refers to the zero-based indexed location
                                of an element in the Select.options array.

selected                     Refers to the selected value of
                                 the select box.

text                            Refers to the text for the option.

value                          Refers to the value that is returned
                                  when the option is selected.

Accessing the value of a dropdown (combobox) is shown in the below example.


You can also get more information regarding various function and propertied of a dropdown (combobox) from the below link.
http://www.navioo.com/javascript/dhtml/Changing_Select_Element_Content_two_Combobox_2755.html

No comments:

Post a Comment