Retrieving data from multiple checkbox option can sometimes a little tricky. This simple code snippet will help listen your work load using jquery.
![How to retrieve value from multiple checkbox 1 How to retrieve value from multiple checkbox JSFiddle Code Playground](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDI0IiBoZWlnaHQ9IjUxOSIgdmlld0JveD0iMCAwIDEwMjQgNTE5Ij48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBzdHlsZT0iZmlsbDojY2ZkNGRiO2ZpbGwtb3BhY2l0eTogMC4xOyIvPjwvc3ZnPg==)
//select all checkboxes
$("#select-all").change( function(){
var status = this.checked;
$('.shipment-options').each( function(){
this.checked = status;
});
});
$('.shipment-options').change(function(){
//uncheck "select all", if one of the listed checkbox item is unchecked
if(this.checked == false){
$("#select-all")[0].checked = false;
}
//check "select all" if all checkbox items are checked
if ($('.shipment-options:checked').length == $('.shipment-options').length ){
$("#select-all")[0].checked = true;
}
});
$('#get-data').on('click', function(){
var persons = [];
$('.shipment-options').each(function(i){
if( $(this).prop('checked') ){
persons.push( $(this).val() ) ;
return;
}
});
alert( persons );
console.log( persons );
});