Skip to content

Commit

Permalink
Change all checkboxes, no matter their name
Browse files Browse the repository at this point in the history
Changing the [name="all"] checkbox in a table should check every checkbox
in the first column. It should not matter if their name is "id[]".

This is very useful for nested tables, because usually there would be nested
forms there as well.
  • Loading branch information
hkdobrev committed Feb 19, 2014
1 parent fc2a4cd commit af8c710
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web/js/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ $(function(){
});

$('body').on('change', 'input[name="all"]', function(e){
$(this).closest('table').find('tbody > tr > td:first-child input[name="id[]"]').prop('checked', $(this).prop('checked'));
$(this).closest('table').find('tbody > tr > td:first-child input[type="checkbox"]').prop('checked', $(this).prop('checked'));
});

$('body').on('click', '[data-toggle="modal"]', function(e) {
Expand Down

0 comments on commit af8c710

Please sign in to comment.