contactform7 prevent multiple submissions

Many users are clicking double or triple times on contact form 7 button submit which causes form to send multiple emails

Multiple submissions on contact form 7 can be prevented by placing this piece of code in your template functions.php

add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
?>
<script type="text/javascript">
(function($) {
        $(document).ready(function() {

                fixCF7MultiSubmit();

                function fixCF7MultiSubmit(){
                                jQuery('input.wpcf7-submit[type="submit"]').click(function() {
                                        var disabled = jQuery(this).attr('data-disabled');
                                        if (disabled && disabled == "disabled") {
                                                return false;
                                        } else {
                                                jQuery(this).attr('data-disabled',"disabled");
                                                return true;
                                        }
                                });
                        jQuery('.wpcf7').bind("wpcf7submit",function(){
                                jQuery(this).find('input.wpcf7-submit[type="submit"]').attr('data-disabled',"enabled");
                        });
                }
        });
}(jQuery));
</script>
<?php
}