select all checkbox code in jquery
sometimes we have multiple checkbox fields in form and require to select all and deselect all. Following is code to select and deselect.
$("#selectAll").click(function(){
          $(".chkboxes").prop("checked",$("#selectAll").prop("checked"))
       }); 
       $(".chkboxes").click(function(){ 
        if($(".chkboxes").length == $(".chkboxes:checked").length) {
            $("#selectAll").prop("checked", true);
        } else {
            $("#selectAll").removeAttr("checked");
        }
       });
          
        