[英]on click event on JQuery chosen plugin
我正在使用選擇的JQuery,並且閱讀了API,然后看到只有此事件才發布
change: Chosen triggers the standard DOM
chosen:ready Triggered after Chosen has been fully instantiated.
chosen:maxselected Triggered if max_selected_options is set and that total is broken.
chosen:showing_dropdown Triggered when Chosen’s dropdown is opened.
chosen:hiding_dropdown Triggered when Chosen’s dropdown is closed.
chosen:no_results Triggered when a search returns no matching results.
但就我而言,即使值未更改,單擊下拉菜單中的一個元素時,我想要的還是一個事件。
有什么建議么?
是的你可以! 檢查jsFiddle: https ://jsfiddle.net/qjjcx2bj/3/
通過獲取選定列表項的索引,可以檢索選定項的值。
var ind = $(this).attr('data-option-array-index');
$("#select1").children('option:eq('+ind+')').val();
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.