Everyone touched it, but no one said it, so I’ll just post another answer, as I do now.
You can use what some other answers suggested and use on_sent_ok
in the CF7 Advanced Settings section. But first, in the "form" field, you need to wrap the contents of the entire form in a div, which we will discuss later:
<div id="form-container"> <h4>Form title</h4> <p>some text, etc</p> ...form fields... </div>
We will use # form-container "for the link in the parameters.
on_sent_ok: "$("#form-container").fadeOut();"
I like to use fadeOut();
due to the animation, but you can add a class or do whatever you need through jQuery.
My reason for this is that I can configure exactly what I want to hide, rather than relying on any element created by CF7 in the DOM.
I think this answers your question without causing conflicts with the success message.
source share