select2 select all code example
Example 1: jquery select2 multiple select all
$("#checkbox").click(function(){
if($("#checkbox").is(':checked') ){
$("select > option").prop("selected","selected");
}else{
$("select > option").removeAttr("selected");
}
});
Example 2: select2
$('.js-example-basic-single').select2({
placeholder: 'Select an option'
});
Example 3: select2
$(".js-example-basic-multiple-limit").select2({
maximumSelectionLength: 3
});