DOMs in CF7
-
I am trying to learn and use DOM events in Contact Form 7. Here is below CF7 code i have
<div id=”hideform”><label> Title (required) [select* title “Mr.” “Mrs.” “Ms.” “Mr. and Mrs.” “Dr.”] </label> <label> First Name (required) [text* first-name] </label> <label> Last Name (required) [text* last-name] </label> <label> Your Email (required) [email* email] </label> [submit “FIND OUT MORE”] </div>
Then the JS I have with it<script> document.addEventListener( ‘wpcf7mailsent’, function( event ) { document.getElementById(‘hideform’).style.display = ‘none’; }, false ); </script>
I am trying to hide the form but it does not hide after mailsent. Any help would be appreciated or right direction :).this is the CF7 DOM events https://contactform7.com/dom-events/
if I do this
document.addEventListener( ‘wpcf7submit’, function( event ) { alert( “Fire!” ); }, false );
it works but me doingdocument.getElementById(‘hideform’).style.display = ‘none’;
does not make the style display as none.I put the div in the CF7 form, above the CF7 form in Visual composer as well.
I have been using this as well as refernce on how to do dom events.
- The topic ‘DOMs in CF7’ is closed to new replies.