龙岩易富通网络科技有限公司

龙岩小程序开发,龙岩分销系统

jquery操作select(取值,设置选中)

2019.03.16 | 1562阅读 | 0条评论 | javascript


1、获取

var checkText=$("#select_id").find("option:selected").text();  //获取Select选择的Text

var checkValue=$("#select_id").val();  //获取Select选择的Value

var checkIndex=$("#select_id ").get(0).selectedIndex;  //获取Select选择的索引值

var maxIndex=$("#select_id option:last").attr("index");  //获取Select最大的索引值

var index = $('#someId').prop('selectedIndex'); //获取选择的索引值

赞 (

发表评论