How do I add an event listener when removing a multi-select item?


#1

Simply put I’d like to perform an operation when I click the x button in a multi-select input. I’ve tried the following but get no response:

<input type="hidden" id="product" />

$('#product').on("select2:unselect", function() {
  // do something
});

#2

Which version of Select2 are you using? There’s a known bug in version 4.0.6 that seems to be related to event handling. If you’re using that version you might want to switch to version 4.0.7-rc.0, which doesn’t have the bug.