jQuery show/hide div and form submit
<p>Simple form which will show additional fields (div class="fold") if a checkbox (div id="foldstate") is marked.</p>

<p>Clicking checkbox hides/shows additional fields as expected.</p>

<p>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 <code>&lt;div class="fold" style="display: none;"&gt;</code></p>

<p>Where is my mistake?</p>

<p>My jQuery code:</p>

<pre><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");
        }
    });
});
</code></pre>
