Use javascript to obtain the selected value of the select tag. Use javascriptselect
Copy codeThe Code is as follows: var obj = document. getElementById ("testSelect"); // locate the id
Var index = obj. selectedIndex; // select an index
Var text = obj. options [index]. text; // select the text
Var value = obj. options [index]. value; // The selected value.
Obtain the selected select value in jQuery.
Method 1
Copy codeThe Code is as follows: $ ('# testSelect option: selected'). text (); // The selected text
$ ('# TestSelect option: selected'). val (); // The selected value.
$ ("# TestSelect"). get (0). selectedIndex; // Index
Method 2
Copy codeThe Code is as follows: $ ("# tesetSelect"). find ("option: selected"). text (); // The selected text
$ ("# TesetSelect"). find ("option: selected"). val ();
$ ("# TesetSelect"). find ("option: selected"). get (0). selectedIndex;
The above is all the content of javascript to obtain the selected values of the select tag. I hope you can give a reference and support the selection.