document.addEventListener( 'wpcf7submit', function( event ) { alert("Fires only on the wpcf7submit event") // Your code }, false );