I am using Select2 on my website and I am trying to use the select2-selecting event, but I am not quitting. I also use Backbone.js in the application, so the first thing I tried was to add select2-selecting to my events object:
// 'change .city':'cityChanged' 'select2-selecting .city':'cityChanged'
Note that the change event is commented out - this change event works correctly. In the documentation for Select2, the select2-selecting event is placed directly on the object, and not like this:
$('.city').select2().on('select2-selecting', function(e){ console.log('here'); });
instead, it is intended to be used as follows:
$('.city').on('select2-selecting', function(e){ console.log('here'); });
I also tried to add an event in both of these ways, but the event did not fire (I checked and the element was created on the DOM before , I added events).
When I add an event in the first method with Backbone.js , the event is displayed in the event listeners in the chrome debug console - it just isn't fired. Does anyone have an idea of ββwhat is going on?
source share