Contact form 7 Hide response messages after 5 seconds

I just installed this plugin and I must say it does everything I need.

I am using a custom made popup div with a CF7 inside it.

I need to hide response messages (error, success message) after 5 seconds. Is that possible?

Topic plugin-contact-form-7 ajax Wordpress

Category Web


you can use below code to hide message

// Contact Form 7 submit event fire
document.addEventListener('wpcf7submit', function(event) {
  setTimeout(function() {
        jQuery('form.wpcf7-form').removeClass('sent');
        jQuery('form.wpcf7-form').removeClass('failed');
        jQuery('form.wpcf7-form').addClass('init');
  }, 1000);

}, false);

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.