I have a jQuery datatable with click of the row opens a bootstrap modal. When I try to reset the selections for the select2 dropdowns on the modal I see an inconsistent behavior, it works for 2-3 times and then it starts selecting last value in the dropdown. I am using this code before showing the modal.
$(’#select2ID’).val(null).trigger(‘change’);
$(’#select2ID’).val(newId).trigger(‘change’);
Any idea what could be the issue? I am using 4.0.13