Just playing around with WordPress / Contact Form 7
.
Is it possible to add custom javascript function on successful email send event?
Just playing around with WordPress / Contact Form 7
.
Is it possible to add custom javascript function on successful email send event?
You must be logged in to post a comment.
Write this in additional settings at the bottom of the contact form configuration page:
UPDATE:
You can use it to call functions like this:
Or write some code (this one redirects to thank you page):
Contact Form 7 emits a number of Javascript events that bubble up to the document object. In version 4.1 they can be found in contact-form-7/includes/js/scripts.js. If you’re using jQuery you can access those events like this:
try this:
Example 1:
Example 2:
In form script:
Then at the bottom of the admin page under “Additional Settings” put the following:
Just a quick note that on_sent_ok is deprecated.
Contact form 7 is now using event listeners, like this;
Then add this to the wp_footer action.
like this;