
置頂隨筆
摘要: 語法解釋:
1. $("#select_id").change(function(){//code...}); //為Select添加事件,當選擇其中一項時觸發
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最大的索引值
jQuery設置Select選擇的Text和Value:
語法解釋:
1. $("#select_id ").get(0).selectedIndex=1; //設置Sel
閱讀全文
posted @
2011-12-14 23:04 古木天琪 閱讀(7151) |
評論 (1) |
編輯 收藏