Friday , December 20 2024

How to hide any blocks when submitting Contact Form 7

Forms can easily be hidden after they’ve been filled out and submitted, because the form gets a class sent when submitted. But there are lot of cases when you need to hide blocks that are placed outside of this form, but which are logically related to the form. If you need to hide other div, p, h2 etc., you can use the following JS code to implement it:

<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
document.getElementById("firstid").className += " mynewclass";
document.getElementById("secondid").className += " mynewclass";
document.getElementById("thirdid").className += " mynewclass";
}, false );
</script>

In CSS file, you need to add

.mynewclass {display: none !important;}

About admin

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

Your email address will not be published. Required fields are marked *