js
选项一
选项二
function gradeChange() {
var myselect = document.getElementById("pid");
var index=myselect.selectedIndex;
// selectedIndex代表的是你所选中项的index
var value = myselect.options[index].value;
console.log(value);
}
jquery
option1
option2
option3
option4
$('#select').change(function() {
//一:
console.log($(this).val());
//二:
var options=$("#select option:selected");
console.log(options.val());
})
标签:Jquery,index,console,option,JS,myselect,var,select,log
来源: https://www.cnblogs.com/suitongyu/p/12066134.html