Created
December 31, 2014 17:49
-
-
Save bran921007/5c1fbb8444c0549a315a to your computer and use it in GitHub Desktop.
Seleccionar todos los checkbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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