1
我爲我的選擇器使用了一個插件。它被稱爲Chosen。我試圖添加一個監聽器到下面的任何一個,但是我覺得這個插件可以防止任何事情發生。理想情況下,我想添加一個事件,以便每次有人向多個選擇組添加「標記」時,都會調用一個方法。然而,事實證明,這應該是更困難的。到目前爲止,我已經嘗試以下內容:將更改事件添加/委託/綁定到選定插件?
//detect when input field changes
$(".chzn-choices").find("input").change(function() { alert("lol I worked"); });
//detect when option is clicked (I dont think this works as a click event is already binded to these and something is preventing the default
$(".chzn-drop").delegate("li", "click", function() { alert("clicked"); });
任何人有任何想法我可以在這裏嘗試嗎?