I have a form where I have 'checkbox sections'.  So, basically, what
I'm trying to do is to determine if one of the checkboxes that belongs
to the parent checkbox has been changed and based on whether or not
something is checked, it will check the parent checkbox...if none are
checked, it will uncheck the parent checkbox.  I have the following,
which of course, doesn't work.  I can't seem to get the siblings line
to work, which I need to determine if any other checkboxes are
selected...

Any ideas?  As you will probably tell from my code, I'm new to
this...

$(function() {

    $('.section-wrap-nested input').change(function(){

                if ( $(this).attr("checked", true) || ($(this).attr("checked",
false) && $(this).siblings().attr("checked", true))) {
                        
$(this).parents(".section-wrap").children(".box").children
("input.toggle").attr("checked", true);

                } else {
                        
$(this).parents(".section-wrap").children(".box").children
("input.toggle").attr("checked", false);

                }

    });

Reply via email to