Skip to content

Instantly share code, notes, and snippets.

@xd547
Created March 4, 2014 07:15
Show Gist options
  • Select an option

  • Save xd547/9341703 to your computer and use it in GitHub Desktop.

Select an option

Save xd547/9341703 to your computer and use it in GitHub Desktop.
jQuery check all
$('#check_all').on('click', function() {
if ($(this).is(':checked')) {
$('input[id*="week"]').prop('checked', true);
} else {
$('input[id*="week"]').prop('checked', false);
}
});
$('input[id*="week"]').on('click', function() {
if ($('input:checked[id*="week"]').size() == $('input[id*="week"]').size()) {
$('#check_all').prop('checked', true);
} else {
$('#check_all').prop('checked', false);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment