Skip to content

Instantly share code, notes, and snippets.

@Neener54
Created May 8, 2014 16:35
Show Gist options
  • Save Neener54/f03e4be3fdf6cb87813a to your computer and use it in GitHub Desktop.
Save Neener54/f03e4be3fdf6cb87813a to your computer and use it in GitHub Desktop.
LIst Sub Selector.js
var listSubSelector = function(){
"use strict";
$('body').on('click','li input', function(){
var $this = $(this);
if ($this.attr('checked')){
$this.parentsUntil('ul').find('input[type="checkbox"]').attr('checked',true);
}else{
$this.parentsUntil('li').find('input[type="checkbox"]').attr('checked',false);
$this.parents('.description').find('input[type="checkbox"]:first').attr('checked',false);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment