小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

jQuery-對Select的操作集合

 handup 2011-01-06

1. $("#select_id").change(function(){//code...});   //為Select添加事件,當選擇其中一項時觸發(fā)
2. var checkText=$("#select_id").find("option:selected").text();  //獲取Select選擇的Text
3. var checkValue=$("#select_id").val();  //獲取Select選擇的Value
4. var checkIndex=$("#select_id ").get(0).selectedIndex;  //獲取Select選擇的索引值
5. var maxIndex=$("#select_id option:last").attr("index");  //獲取Select最大的索引值 

6. $("#select_id ").get(0).selectedIndex=1;  //設置Select索引值為1的項選中
7. $("#select_id ").val(4);   //設置Select的Value值為4的項選中
8. $("#select_id option[text='jQuery']").attr("selected", true);   //設置Select的Text值為jQuery的項選中

9. $("#select_id").append("<option value='Value'>Text</option>");  //為Select追加一個Option(下拉項)
10. $("#select_id").prepend("<option value='0'>請選擇</option>");  //為Select插入一個Option(第一個位置)
11. $("#select_id option:last").remove();  //刪除Select中索引值最大Option(最后一個)
12. $("#select_id option[index='0']").remove();  //刪除Select中索引值為0的Option(第一個)
13. $("#select_id option[value='3']").remove();  //刪除Select中Value='3'的Option
14. $("#select_id option[text='4']").remove();  //刪除Select中Text='4'的Option

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約