In various site applications, it is easy and useful to use jQuery to obtain the value of the select element. It is the same function that is essential for most sites on the network. Every time you make a selection, the system gets the value you choose and uses it to filter and display a list of other options.
The following describes how to implement this function.
(1) Prepare the select element used to obtain the option value.
<Select id = "my-select" name = "questionl">
<Option value = "yes"> yes </option>
<Option value = "no"> no </option>
</Select>
(2) select # my-select Shen wusu, and then bind the change event handler function to it:
$ ('# My-select'). change (function (){
});
(3) obtain the value of the selected item and assign it to the variable selectVal:
$ ('# My-select'). change (function (){
Var selectVal = $ (this). val ();
Alert (selectVal );
});