Skip to content

Instantly share code, notes, and snippets.

@marioblas
Created February 12, 2014 23:24
Show Gist options
  • Save marioblas/8966666 to your computer and use it in GitHub Desktop.
Save marioblas/8966666 to your computer and use it in GitHub Desktop.
jQuery - Know if all checkboxes are selected
/**
* 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