选择select2的allowClear选项时如何捕获事件? [英] How to capture event when allowClear option of select2 is chosen?
本文介绍了选择select2的allowClear选项时如何捕获事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图捕获 select2:清算
事件
$("#my-select").on("select2:clearing", function (e) {
console.log('cleared');
});
( jsfiddle )
但不会被解雇。我也尝试了其他版本(如 select2:已删除
等,请参阅另一个问题有类似的问题),但它也不起作用。
but it is not fired. I've also tried other versions (like select2:removed
etc., see another question with similar problem), but it also doesn't work.
我使用select2 4.0.0-beta2。
I use select2 4.0.0-beta2.
推荐答案
select2 4.0.0-beta2的更改日志状态:
The changelog of select2 4.0.0-beta2 states:
删除事件
Removed events
select2-clearing - Use select2:unselecting instead
https://github.com/select2/select2/releases
这篇关于选择select2的allowClear选项时如何捕获事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文