I am using Select2 in my website, and I'm trying to use the select2-selecting
event, but its not firing. I am also using Backbone.js in the app, so the first thing I tried was adding the select2-selecting
to my events
object:
// 'change .city':'cityChanged'
'select2-selecting .city':'cityChanged'
Note that I have a change
event commented out - this change
event works properly. In the documentation for Select2, the select2-selecting
event is put directly on the object, not like this:
$('.city').select2().on('select2-selecting', function(e){
console.log('here');
});
instead, its supposed to be used like this:
$('.city').on('select2-selecting', function(e){
console.log('here');
});
I have also tried adding the event both of these ways, but the event didn't fire (I did check and the element was created on the DOM before I added the events).
When I add the event in the first method with the Backbone.js, the event is listed in the event listeners in the chrome debug console - it just doesn't get fired. Does anyone have an idea what is going on?