Hi @davidwong3937
I hope you’re well today!
You can use this code:
add_action(
'wp_footer',
function() {
if ( ! class_exists( 'Forminator' ) ) {
return;
}
?>
<script>
(function($){
$(function(){
function wpmudev_fm_avoid_duplicate_submissions( _forms ){
if( _forms.length ){
let _parent_button = null,
_timeout = null;
setTimeout(function(){
_forms.on('click', '.forminator-button-submit', function(){
alert('something');
});
}, 200);
}
}
wpmudev_fm_avoid_duplicate_submissions( $('.forminator-custom-form') );
// Support ajax.
$(document).on('after.load.forminator', function(e, _form_id){
wpmudev_fm_avoid_duplicate_submissions( $('#forminator-module-'+ _form_id) );
});
});
})(window.jQuery)
</script>
<?php
},
21
);
You’d need to add it to your site in your own plugin or via MU plugin or to your theme’s “functions.php” file.
Your own code that should be executed upon click, should go instead this line:
alert('something');
Best regards,
Adam