鍍金池/ 問答/HTML/ jquery select下拉框無法實現(xiàn)選中后觸發(fā)事件(使用的是searchab

jquery select下拉框無法實現(xiàn)選中后觸發(fā)事件(使用的是searchableSelect這個下拉框插件)

這樣一個select下拉框:
<body>
<select id="law_question">

  <option></option>

</select>
</body>

for(var i=0;i<data.length;i++){
$("#law_question").append("<option value='"+data[i].content+"'>"+data[i].content+"</option>")
}

我想實現(xiàn)選中后觸發(fā)事件,但是像下面這樣寫無效:
$("#law_question").select(function(){
alert("您選中的是:"+$(this).val());
})

用的是searchableSelect下拉框插件,jquery版本是1.11.1

回答
編輯回答
別逞強
$('#law_question').searchableSelect({  
                afterSelectItem: function(){  
                    alert(this.holder.text());  
                    alert(this.holder.data("value"));  
                }  
            });  

這樣試試呢?

2018年4月7日 19:05