龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

jquery操作select(取值,設(shè)置選中)

2019.03.16 | 1786閱讀 | 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'); //獲取選擇的索引值

贊 (

發(fā)表評論