Why does the select2-removing event not trigger in select2 with allowClear?
javascript, jquery, jquery-select2
Solution
According to the select2 source code, the `clear` method use the event `select2-clearing` instead of `select2-removing`. So you should listen to this event too.
`select2-clearing` and `select2-removing` are triggered before the removal. `select2-removed` is triggered after.
Keep in mind that `clear` does not always trigger the `select2-removed` event. It look like this event is triggered only if an element is actually removed from the input.
Problem
I want to hook an event in my select2 once it gets cleared. The select2 was initalized with `allowClear: true`. Yet the event ``` $select.on('select2-removed', function(event) { console.log(event); }); ``` does not trigger when resetting the select2 with the clear button.