select2 is called what code example
Example 1: select2 destroy
if ($('#mySelect2').hasClass("select2-hidden-accessible")) {
// Select2 has been initialized
$('#mySelect2').select2('destroy');
}
Example 2: jquery select2 multiple select all
$("#checkbox").click(function(){
if($("#checkbox").is(':checked') ){
$("select > option").prop("selected","selected");
}else{
$("select > option").removeAttr("selected");
}
});