Hi,
I have my dropdowns appended dynamically in various situations. Now in a multi-select dropdown, I try to get the latest value selected using the select2:select
event.
When this event is fired I get multiple logs for the single action.
Here is the complete code:
$(document).on('change', '.optionsDropDown', function (e) {
$('#myid').on('select2:select', function (e) {
var data = e.params.data;
console.log(data)
})
$('#myid').on('select2:unselect', function (e) {
var data = e.params.data;
console.log(data)
})
})
It works fine for the dropdowns which are not appended dynamically.