Keep Your Elementor Form Hidden After Submission Using Cookies

Facebook
Twitter
Reddit
WhatsApp

jQuery - Make sure this goes under the form.

				
					<script>window.addEventListener('DOMContentLoaded', function() {
    const $ = jQuery;
    $(document).ready(function(){
        const formSubmit = localStorage.getItem('formSubmit')
        
        if(formSubmit){
            console.log('form submitted')
            $('.myForm').hide()
            $('.form-message').show()
            
        }
        
        $('.myForm form').submit(function(){
            localStorage.setItem('formSubmit', 'true')
            $('.myForm').hide()
            $('.form-message').show()
            
        })
    })
});</script>
				
			

CSS - Add this to your form message or section.

				
					selector{display:none;}
				
			
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments

More to explorer

0
Would love your thoughts, please comment.x
()
x

45 Minute Wordpress Support

Get your Wordpress questions answered and your Wordpress issues resolved.