jQuery select all boxes description.
<?php
/*
You of course need to make sure the jQuery js file is being included. Here is one method of implementing this:<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="mce-no/type" data-mce-src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>-- */ ?>
<script>
jQuery(document).ready(function($) {
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.cboxes').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.cboxes').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
});
</script>
<table>
<tbody>
<tr>
<td><input id="selectall" name="selectall" type="checkbox" /></td>
</tr>
<tr>
<td><input class="cboxes" name="repeatedbox[]" type="checkbox" value="yes" /></td>
<td><input class="cboxes" name="repeatedbox[]" type="checkbox" value="yes" /></td>
<td><input class="cboxes" name="repeatedbox[]" type="checkbox" value="yes" /></td>
<td><input class="cboxes" name="repeatedbox[]" type="checkbox" value="yes" /></td>
</tr>
</tbody>
</table>