js 获取select的值

var t = document.getElementById("provid");


console.log(t.value);

console.log(t.text); //未定义

console.log(t.selectedIndex); //有效

var text = t.options[t.selectedIndex].text; // 选中文本
var value = t.options[t.selectedIndex].value; // 选中值

console.log(text);
console.log(value);

猜你喜欢

转载自www.cnblogs.com/enych/p/11452532.html