Return to Snippet

Revision: 30889
at August 24, 2010 22:47 by knedle


Initial Code
$("ul input:checkbox").change(function(){
        
        if ($(this).is(':checked')) {
            // children
            $(this).parent().find("input:checkbox").attr('checked', 'checked');
        }
        else {
            // children
            $(this).parent().find("input:checkbox").removeAttr('checked');
            // parents
            $(this).parents('li').each(function(){
                $(this).children('input:checkbox').removeAttr('checked');
            });
        }
    });

Initial URL
http://jsfiddle.net/4QmNn/

Initial Description
logical action on tree with checkboxes

Initial Title
check / uncheck checkboxes in tree

Initial Tags
jquery

Initial Language
jQuery