Created
November 9, 2018 23:30
-
-
Save theonlydaleking/06f6b2d151d1af78c586f804d7e29102 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Prevent Multi Submit on WPCF7 forms | |
add_action( 'wp_footer', 'mycustom_wp_footer' ); | |
function mycustom_wp_footer() { | |
?> | |
<script type="text/javascript"> | |
var disableSubmit = false; | |
jQuery('input.wpcf7-submit[type="submit"]').click(function() { | |
jQuery(':input[type="submit"]').attr('value',"Sending...") | |
if (disableSubmit == true) { | |
return false; | |
} | |
disableSubmit = true; | |
return true; | |
}) | |
var wpcf7Elm = document.querySelector( '.wpcf7' ); | |
wpcf7Elm.addEventListener( 'wpcf7submit', function( event ) { | |
jQuery(':input[type="submit"]').attr('value',"send") | |
disableSubmit = false; | |
}, false ); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment