I have been told to add below snippet to the footer.php, and doing so will enable CF7 plugin to not clear the form field values from all the fields in a form after its submitted.
<script>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
jQuery(‘.wpcf7’).find(‘form’)[0].reset();
}, false );
</script>
I added the above code as displayed into footer.php, but it’s not working. Am I doing something wrong? Should it be put in a certain area of the php file?
I copied footer.php into my child theme folder first, then pasted the code into that.
Also tried it with php open and close tags (instead of ‘script’)
It seems weird to add this to the footer. Should it not be functions.php?
thanks,