Created
February 12, 2014 23:24
-
-
Save marioblas/8966666 to your computer and use it in GitHub Desktop.
jQuery - Know if all checkboxes are selected
This file contains 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
/** | |
* Know if all checkboxes are selected. | |
* Note: You can add the same class for each checkbox instead of use :checkbox selector | |
*/ | |
$(':checkbox').on('change', function() { | |
if ( $(':checkbox:checked').length == $(':checkbox').length ) { | |
// Do something | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment