Reputation: 4517
I have connected select-2 plugin to my select element and now I would like to assign one event to it: to reload the form after clicking .select2-search-choice-close, but I'm unable to bind any event to this element.
Before binding the event I have tried unbinding all events and changing parent's href
attribute:
$('.select2-choice').attr('href', '#'); // remove javascript:void(0)
$('.select2-search-choice-close').off();
but still:
$('#dashboard').on('click', '.select2-search-choice-close', function(e) {
e.preventDefault();
alert('test');
console.log('test');
};
none of this happen when I click .select2-search-choice-close.
We are using Version: 3.5.2 and I can't change it unfortunately.
Upvotes: 2
Views: 2636
Reputation: 186
use change event
$('#dashboard').on("change", function (e) {alert('test');});
Upvotes: 2