<select name= "" id= "Testselect" onclick= "Test2 ()" >
<option value= "1" >a</option>
<option value= "2" >b</option>
<option value= "3" >c</option>
<option value= "4" >d</option>
</select>
<script src= "Js/jquery.min.js" ></script>
<script>
function Test () {
var obj = document.getElementById ("Testselect"); Location ID
Console.log (obj);
var index = Obj.selectedindex; Check Index
Console.log (index);
var text = Obj.options[index].text; Select text
Console.log (text);
var value = Obj.options[index].value; Checked values
Console.log (value);
}
function Test1 () {
Console.log ($ (' #testSelect option:selected '). text ());//Selected texts
Console.log ($ (' #testSelect option:selected '). Val ());//The selected value
Console.log ($ ("#testSelect"). Get (0). SelectedIndex);//Index
}
function Test2 () {
Console.log ($ ("#testSelect"). Find ("option:selected"). Text ());//Selected
Console.log ($ ("#testSelect"). Find ("option:selected"). Val ());
Console.log ($ ("#testSelect"). Get (0). SelectedIndex);
}
</script>
JS Gets the selected value of the Select tag