How to capture event when allowClear option of select2 is chosen?
This works:
$("#my-select").on("select2:unselecting", function(e) {
});
$("#my-select").on("select2:select select2:unselecting", function(e) {
//do something here
});
The changelog of select2 4.0.0-beta2 states:
Removed events
select2-clearing - Use select2:unselecting instead
https://github.com/select2/select2/releases