下拉框的change事件

假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击http://106.12.206.16:8080/qingruihappy/index.html
6.1,获取下拉框的值(html标签中没有onchange事件的)


$(document).ready(function() {
//绑定下拉框change事件,当下来框改变时调用 SelectChange()方法
$("#selectID").change(function() { SelectChange(); });
})
function SelectChange() {
//获取下拉框选中项的text属性值
var selectText = $("#selectID").find("option:selected").text();
alert(selectText);
//获取下拉框选中项的value属性值
var selectValue = https://www.it610.com/article/$("#selectID").val();
alert(selectValue);
//获取下拉框选中项的index属性值
var selectIndex = $("#selectID").get(0).selectedIndex;
alert(selectIndex);
获取下拉框最大的index属性值
var selectMaxIndex = $("#selectID option:last").attr("index");
alert(selectMaxIndex);
}








【下拉框的change事件】
6.2,获取下拉框的值(html标签中有onchange事件的)



* 结算方式:







function loadSettlementCycle() {
//获取下拉框选中项的text属性值
var selectText = $("#key_ESPaymentMethod").find("option:selected").text();
alert(selectText);
//获取下拉框选中项的value属性值
var selectValue = https://www.it610.com/article/$("#key_ESPaymentMethod").val();
alert(selectValue);
//获取下拉框选中项的index属性值
var selectIndex = $("#key_ESPaymentMethod").get(0).selectedIndex;
alert(selectIndex);
获取下拉框最大的index属性值
var selectMaxIndex = $("#key_ESPaymentMethod option:last").attr("index");
alert(selectMaxIndex);
}
假如你现在还在为自己的技术担忧,假如你现在想提升自己的工资,假如你想在职场上获得更多的话语权,假如你想顺利的度过35岁这个魔咒,假如你想体验BAT的工作环境,那么现在请我们一起开启提升技术之旅吧,详情请点击http://106.12.206.16:8080/qingruihappy/index.html

    推荐阅读