Made a reply before, but I think I've messed with my subscription so
it never came up.
Here it goes again, first alot of code:

<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">

$(document).ready(function(){

        $("[EMAIL PROTECTED]'checkbox']").click(function(){
                if ($(this).is(":checked")){
                        $(this).siblings("ul").hide("slow");
                } else {
                        $(this).siblings("ul").show("slow");
                }
        });
});

</script>
</head>
<body>
<ul>
        <li><input type="checkbox" name="checkboxA1">checkboxA1
                <ul>
                        <li><input type="checkbox" 
name="checkboxA1_1">checkboxA1_1</li>
                        <li>
                                <input type="checkbox" 
name="checkboxA1_2">checkboxA1_2
                                <ul>
                                        <li><input type="checkbox" 
name="checkboxA1_2_1">checkboxA1_2_1</
li>
                                        <li><input type="checkbox" 
name="checkboxA1_2_2">checkboxA1_2_2</
li>
                                </ul>
                        </li>
                        <li><input type="checkbox" 
name="checkboxA1_3">checkboxA1_3</li>
                </ul>
        </li>

        <li><input type="checkbox" name="checkboxB1">checkboxB1
                <ul>
                        <li><input type="checkbox" 
name="checkboxB1_1">checkboxB1_1</li>
                        <li>
                                <input type="checkbox" 
name="checkboxB1_2">checkboxB1_2
                                <ul>
                                        <li><input type="checkbox" 
name="checkboxB1_2_1">checkboxB1_2_1</
li>
                                        <li><input type="checkbox" 
name="checkboxB1_2_2">checkboxB1_2_2</
li>
                                </ul>
                        </li>
                        <li>
                                <input type="checkbox" 
name="checkboxB1_3">checkboxB1_3
                                <ul>
                                        <li><input type="checkbox" 
name="checkboxB1_2_1">checkboxB1_3_1</
li>
                                        <li><input type="checkbox" 
name="checkboxB1_2_2">checkboxB1_3_2</
li>
                                </ul>
                        </li>
                </ul>
        </li>

</ul>
</body>
</html>

This should work for what you wanted, changed the event to click as
Whalin (thx for the reminder, had forgotten abt that) mentions.
//Kristinn

On Feb 18, 12:53 am, Gorkfu <[EMAIL PROTECTED]> wrote:
> Thanks for the suggestion I must be blind, since I didn't see the change
> event when i was going through them. It works like a charm, thanks.
>
> Now to figure this out for multiple levels such as..
>
> <>checkboxA1
>         <>checkboxA2
>                 <>checkboxA3
>                 <>checkboxA3
> <>checkboxB1
>         <>checkboxB2
>                 <>checkboxB3
>                 <>checkboxB3
>
> I could type the code over and over but that would not be appropriate
> coding, such as the following:
>
>         $("[EMAIL PROTECTED]'checkboxA1']").change(function(){
>                 if ($(this).is(":checked")){
>                         $("div.checkboxA2").hide("slow");
>                 } else {
>                         $("div.checkboxA2").show("slow");
>                 }
>         });
>
>         $("[EMAIL PROTECTED]'checkboxA2']").change(function(){
>                 if ($(this).is(":checked")){
>                         $("div.checkboxA3").hide("slow");
>                 } else {
>                         $("div.checkboxA3").show("slow");
>                 }
>         });
>
>
>
> Alexandre Plennevaux wrote:
>
> > I would try somehting like this:
>
> > $(document).ready(function(){
> >    $('[EMAIL PROTECTED]'checkbox']).change(function(){
>
> >            If ($(this).is(":checked")){
> >                    $("div.sub2").hide("slow");
> >            }
> >            else
> >            {
> >                    $("div.sub2").show("slow");
> >            }
>
> >    });
> > });
>
> --
> View this message in 
> context:http://www.nabble.com/Loop-Checkbox-Action-Question-tf3246372.html#a9...
> Sent from the JQuery mailing list archive at Nabble.com.
>
> _______________________________________________
> jQuery mailing list
> [EMAIL PROTECTED]://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to