Hide Contact Form 7 after successful send

In WordPress Contact Form 7 plugin, after form is submited and data is sent successful, visitor gets the message about it bellow the form. Sometimes you may want actual form fields to get hide after sending. Here is pretty easy way how you can do that:

Wrap whole form in new div:

<div id="asaphide">
 
... contact form fields ...
 
</div>

At the bottom of form page in WP admin, enter this into Additional Settings:

on_sent_ok: "document.getElementById('asaphide').style.display = 'none';"

That’s it.

Here is example how that can look like:

empty contact form 7

form sent hiden fields

Facebooktwitterredditpinterestlinkedinmail

20 comments for “Hide Contact Form 7 after successful send

Leave a Reply

Your email address will not be published. Required fields are marked *