Home > Article > Web Front-end > A large collection of jQuery operations on Select (collection)_jquery
1.jQuery adds/removes the Option item of Select:
2.$("#select_id").append(""); //Add an Option (drop-down item) to Select
3.$("#select_id").prepend("
1.jQuery gets the Text and Value selected by Select:
2.$("#select_id").change(function(){//code.. .}); //Add an event for Select, which is triggered when one of the items is selected
3.var checkText=$("#select_id").find("option:selected").text(); //Get Select's Text
4.var checkValue=$("#select_id").val(); //Get Select's Value
5.var checkIndex=$("#select_id ").get(0 ).selectedIndex; //Get the index value of Select
6.var maxIndex=$("#select_id option:last").attr("index"); //Get the maximum index value of Select jQuery sets Select selection Text and Value: