Contact Form 7 – How to create javascript triggers for a specific contact form 7 in wordpress?

View QuestionsCategory: CodeContact Form 7 – How to create javascript triggers for a specific contact form 7 in wordpress?
admin Staff asked 3 years ago
1 Answers
Best Answer
admin Staff answered 3 years ago

Use this to capture event after a successful form submission

Credit: https://stackoverflow.com/questions/46977362/target-wpcf7mailsent-of-a-specific-contact-7-form

1
2
3
4
5
6
7
document.addEventListener( 'wpcf7mailsent', function( event ) {
    console.log(event.detail)

    if(event.detail.contactFormId == '3112') {
    //put your code here
    }
}, false );