on select2 select code example
Example 1: select2.org events
$('#mySelect2').on('select2:select', function (e) {
var data = e.params.data;
console.log(data);
});
Example 2: select2
$('.js-example-basic-single').select2({
placeholder: 'Select an option'
});
Example 3: select2
$(".js-example-basic-multiple-limit").select2({
maximumSelectionLength: 3
});