Hi guys, apologies if this topic has come up before but I couldn’t find a way to search the mailing list archives.

 

What I’m trying to do is filter a bunch of checkboxes (show / hide them) based on the selections you make on a preceding group of checkboxes.

 

In this case I’m filtering a list of areas based on the state(s) selected.

 

Here’s the _javascript_

 

$('.top .state [EMAIL PROTECTED]"checkbox"]').click(

function(){

            $('.top .area label').not('[EMAIL PROTECTED]"'+$(this).id()+'"]').not('.title').toggle();

                                               

            $('.top .state [EMAIL PROTECTED]"checkbox"]').each(function(){

                        if($(this).is(":checked")){

                        $('.top .area label').filter('[EMAIL PROTECTED]"'+$(this).id()+'"]').not('.title').show();

                         }

            });       

});

 

I check the id of the area labels to see if they contain the id of the state that was clicked, then toggle it. This works for single selections but goes all screwy when multiple states are selected.

 

The each loop is where I tried to check and account for multiple selections but im not sure of my logic.

 

Thanks in advance!

 

- reyn

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to