Grow your CSS skills. Land your dream job.

how to stop page reload on "submit"?

  • # April 27, 2010 at 4:38 pm

    Long time reader, first time poster.

    I have a contact form that is hidden when the page loads. When "contact" button (.contact_btn) is clicked, the container (#frmWrap) holding the form slides open. It works exactly as I want. Except when you submit the form, the page loads and the container is hidden again. That would be fine but because I’m using server side php to validate the form, if there was an error or you forgot to fill something in, it is now hidden until you click the contact button again to slide open the panel. Is there a way to submit that form without the page reloading? Here’s my script if it helps any.

    $(document).ready(function(){

    // hides the form container
    $("#frmWrap").hide();

    $(".contact_btn").click(function(){
    $("#frmWrap").slideToggle("slow");
    $(this).toggleClass("active"); return false;
    });

    });

    Thanks for your help

    # April 27, 2010 at 4:47 pm

    Or it would also be fine if the #frmWrap just stayed open after the submit button was clicked.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".