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

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -