How to hide a div if no checkbox is selected jQuery -
if no checkbox selected, how .slideup parent div?
if ($("input:checkbox:not(:checked)")) { $("#parentofparentdiv").slideup(); // should slide entire parent div if none selected, doesnt work } else { $("input:checkbox:not(:checked)").closest('div').slideup(); //this should slideup divs not checked, works }
you need this:
if (!$(":checkbox").is(":checked")) { $("#parentofparentdiv").slideup(); } else { $("input:checkbox:not(:checked)").closest('div').slideup(); }
Comments
Post a Comment