Skip to content

Instantly share code, notes, and snippets.

@bran921007
Created December 31, 2014 17:49
Show Gist options
  • Save bran921007/5c1fbb8444c0549a315a to your computer and use it in GitHub Desktop.
Save bran921007/5c1fbb8444c0549a315a to your computer and use it in GitHub Desktop.
Seleccionar todos los checkbox
//class="chkSelectAll" esta en el checkbox principal(th) que debe seleccionar todos los usuarios
//class="file-todo" son los checkbox particulares de cada td en una tabla
$('.chkSelectAll').click(function () {
$('.file-todo').prop('checked', $(this).is(':checked'));
});
$('.file-todo').click(function () {
if ($('.file-todo:checked').length == $('.file-todo').length) {
$('.chkSelectAll').prop('checked', true);
}
else {
$('.chkSelectAll').prop('checked', false);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment