Created
May 8, 2014 16:35
-
-
Save Neener54/f03e4be3fdf6cb87813a to your computer and use it in GitHub Desktop.
LIst Sub Selector.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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