Refresh Reset Contact Form 7 and DIV after submission, and after 10 seconds reset without page refresh
Refresh Reset Contact Form 7 and DIV after submission, and after 10 seconds reset without page refresh
I created a Contact Form 7 that hides after validation and sent ("wpcf7mailsent") and displays a DIV with a thank you message. Everything works. BUT!! I want the form to refresh without page reload, and hide the Thank You DIV after 10 seconds. Can you show me the direction or how to achieve this? After 10 seconds I want the form to reappear blank and the thank you div is returned to "display:none"
HTML:
<div id="quote" class="qtWRP">[contact-form-7 id="9a5f5ae" title="Quote" html_name="quote" html_id="quote"]</div>
<div id="qtWRP2" class="qtWRP2" style="display: none;">
<div class="thk">Thank you.</div>
<div class="thk2">We received your TUBSAFE quote request, and a member from our team will contact to help you get started with your bathroom project.</div>
</div>
CSS:
.qtWRP {
width: 100%;
display:flex;
margin-top: 0px;
padding: 20px;
position:relative;
}
.qtWRP2 {
width: 100%;
margin-top: 0px;
padding: 20px;
}
JAVASCRIPT:
addEventListener('wpcf7mailsent', function(event) {
event.preventDefault();
document.querySelector('.qtWRP').style.display = 'none';
document.querySelector('.cap').style.display = 'none';
document.querySelector('.qtWRP2').style.display = 'block';
});
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand