Simple form which will show additional fields (div class="fold") if a checkbox (div id="foldstate") is marked.
Clicking checkbox hides/shows additional fields as expected.
Checking the checkbox, filling out the additional fields and submitting (preview) the forms input with php for some server side validation shows up checkbox checked but the fold got still <div class="fold" style="display: none;">
Where is my mistake?
My jQuery code:
$(document).ready(function() { if ($("#foldstate").not(":checked")) { $(".fold").css("display","none"); } $("#foldstate").click(function(){ if ($("#foldstate").is(":checked")) { $(".fold").show("fast"); } else { $(".fold").hide("fast"); } }); });