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: jquery select2 multiple select all
$("#checkbox").click(function(){
if($("#checkbox").is(':checked') ){
$("select > option").prop("selected","selected");
}else{
$("select > option").removeAttr("selected");
}
});