tags:

views:

47

answers:

2

Hi guys! I'm working on a form for a client and he has given me the task to create a show/hide effect when certain checkbox in unselected. Please if you know the answer or any work around for this I would be deeply thankful. Thanks.

+1  A: 

This function should do it:

$("#yourCheckboxID").click(function ()
{
    if ($("#yourCheckboxID").attr("checked"))
    {
        $("#yourDivID").show();
    }
    else
    {
        $("#yourDivID").hide();
    }              
});

It will hide or show a specific div based on a checkbox. I wasn't sure exactly what you were trying to hide or show so I just assumed a div.

Kelsey
This worked perfect. Thank you so much.
Ozzy
+2  A: 
$("#checkboxID").change(function() { $("#targetToHideAndShow").toggle() } );
Razor