Created
August 4, 2024 15:42
-
-
Save marklchaves/b0dbca64ac2ee89d8dcb358e624baa32 to your computer and use it in GitHub Desktop.
After submit, hide the Contact Form 7 form so only the success message shows then redirect after 3 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
document.querySelectorAll("form.wpcf7-form > :not(.wpcf7-response-output)").forEach(el => { | |
el.style.display = 'none'; | |
}); | |
// Redirect on submission | |
setTimeout( () => { | |
location = '/my-redirect-page/'; // TO DO: Put your URL or slug here. | |
}, 3000 ); // Wait for 3 seconds to redirect. Change the delay to what you want. | |
}, false ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment