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
2010-06-23 18:27:50
This worked perfect. Thank you so much.
Ozzy
2010-06-23 18:47:33
+2
A:
$("#checkboxID").change(function() { $("#targetToHideAndShow").toggle() } );
Razor
2010-06-23 18:32:31