<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"); //定位id
console.log(obj);
var index = obj.selectedIndex; // 选中索引
console.log(index);
var text = obj.options[index].text; // 选中文本
console.log(text);
var value = obj.options[index].value; // 选中值
console.log(value);
}
function test1(){
console.log($('#testSelect option:selected').text());//选中的文本
console.log($('#testSelect option:selected') .val());//选中的值
console.log($("#testSelect ").get(0).selectedIndex);//索引
}
function test2(){
console.log($("#testSelect").find("option:selected").text());//选中的文本
console.log($("#testSelect").find("option:selected").val());
console.log($("#testSelect ").get(0).selectedIndex);
}
</script>