Skip to content

Instantly share code, notes, and snippets.

@xto3na
Created September 21, 2015 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xto3na/f72a0b047202a5c6d4e5 to your computer and use it in GitHub Desktop.
Save xto3na/f72a0b047202a5c6d4e5 to your computer and use it in GitHub Desktop.
Tree CHECKED
<script type="text/javascript">
$('input[type="checkbox"]').on("click", function() {
var items = $(this).closest("li").find("input");
if ($(this).is(':checked')) {
for(var i = 0; i< items.length; i ++) {
items[i].checked = true;
}
}else {
console.log("false");
for(var i = 0; i< items.length; i ++) {
items[i].checked = false;
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment