Forums
(@lilyput007)
6 years, 11 months ago
You would of needed to put the javascript I posted earlier in your template file or maybe at the end of your contact7 form for it to work.
I had the same problem and couldn’t update past 4.7 but eventually got it working. If you reverted back to 4.7, have you put the original code back in additional settings and removed the javascript from the footer?
Did you change the id ‘hideform’ to the id of your containing div ?
This is my div which contains my form
<div id="hideform" class="form-group-res">
Make sure you have the latest version of contact7. I’m running version 5.0
Here you go. It doesn’t work if put inside additional settings, so put it in the footer – it works for me.
<script> document.addEventListener( 'wpcf7mailsent', function( event ) { document.getElementById('hideform').style.display = 'none'; }, false ); </script>
Other DOM events here https://contactform7.com/dom-events/
7 years ago
Check the opening and closing apostrophe in the pasted code is correct and not special characters.
this won’t work (copied and pasted from the above code) document.getElementById(‘asaphide’).style.display = ‘none’;
this will document.getElementById('asaphide').style.display = 'none';
document.getElementById('asaphide').style.display = 'none';