1var values=[];
2$('input[name="your-checkbox-name[]"]:checked').each(function () {
3 values[values.length] = (this.checked ? $(this).val() : "");
4});
1$("#checkAll").click(function(){
2 $('input:checkbox').not(this).prop('checked', this.checked);
3});
4
1$('#select_all').change(function() {
2 var checkboxes = $(this).closest('form').find(':checkbox');
3 checkboxes.prop('checked', $(this).is(':checked'));
4});
1<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
2<form>
3 <table>
4 <tr>
5 <td><input type="checkbox" id="select_all" /></td>
6 </tr>
7 <tr>
8 <td><input type="checkbox" name="select[]" /></td>
9 </tr>
10 <tr>
11 <td><input type="checkbox" name="select[]" /></td>
12 </tr>
13 <tr>
14 <td><input type="checkbox" name="select[]" /></td>
15 </tr>
16 </table>
17</form>