select2 selected from jquery 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: jquery select2
//Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.