Skip to content

Instantly share code, notes, and snippets.

@b0n
Created November 12, 2015 08:19
Show Gist options
  • Save b0n/679862820d7870b9a11d to your computer and use it in GitHub Desktop.
Save b0n/679862820d7870b9a11d to your computer and use it in GitHub Desktop.
Checkbox family checked each other between parent and childrens.
$(function() {
$("#search > div > div.box.f-left > ul > li > input.genre").each(function() {
$(this).prop('checked', true);
if (!$(this).next().next().find('input:checkbox').prop('checked')) {
$(this).prop('checked', false);
}
});
$("#search > div > div.box.f-left > ul > li > input.genre").bind('change', function() {
$(this).next().next().find('input:checkbox').prop('checked', this.checked);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment