Redirect contact form 7 with javascript

Question :
I do not want to use the additional setting because its filled with a bunch of analytics code. I want to my javascript function to fire when the button is clicked. example the contact form 7's button ID is #aft_submit.
Redirect contact form 7 with javascript
Soution code for : Redirect contact form 7 with javascript
Seen as you are using jquery anyway, you can add the click on the submit button like this
jQuery( document ).ready(function() {
    jQuery("#aft_submit").on('click', function(e){
        e.preventDefault();
        window.location.href  = "http://url-to-redirect.com";
    });
}
You'll need to prevent the default 'submit' action

No comments:

Post a Comment