I know there are jquery snippets all over the internet showing how to show/hide <div> text based on whether a checkbox has been checked. Jquery is not a strong point of mine so I've really researched a lot to figure out how to do this. So far I'm able to get the <div> text to show when the appropriate checkbox is checked but the problem is, when the checkbox is unchecked the <div> text stays showing and doesn't go back to "hide".
Here's a link to the test page I've made. http://www.friendshipcirclenc.org/show-hide-test/
You'll notice that when the 2nd or 3rd checkbox is checked, additional form fields show but when either of those boxes are unchecked nothing happens.
Here's my code:
$(document).ready(function() {
//Hide the field initially
$("#dad_address").hide();
$('#dadaddress').click(function() {
if ($(this).is(':checked')) {
$("#dad_address").show('fast');
}
else
{
$("#dad_address").hide('fast');
}
});
$("#mom_address").hide();
$('#momaddress').click(function() {
if ($(this).is(':checked')) {
$("#mom_address").show();
}
else
{
$("#mom_address").hide();
}
});
});
Any help would be much appreciated.
Thanks in advance,
fcvolunteer