JQuery gets the text and value selected in the select list box

From , 4 Years ago, written in JavaScript, viewed 52 times.
URL https://pastebin.vip/view/08808cfb
  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最大的索引值
  6. //javascript/7078

Reply to "JQuery gets the text and value selected in the select list box"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website