下拉框的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事件】 |
|
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); } |
推荐阅读
- 热闹中的孤独
- JAVA(抽象类与接口的区别&重载与重写&内存泄漏)
- 放屁有这三个特征的,请注意啦!这说明你的身体毒素太多
- 一个人的旅行,三亚
- 布丽吉特,人生绝对的赢家
- 慢慢的美丽
- 尽力
- 一个小故事,我的思考。
- 家乡的那条小河
- 《真与假的困惑》???|《真与假的困惑》??? ——致良知是一种伟大的力量