function prefix_contact_form_custom_js() { ?> <script type='text/javascript'> /** Document ready. We are waiting for the full page load. */ jQuery( document ).ready( function() { /** Click on link or button that opens the popup. It contain "#elementor-action" in href. */ jQuery( document ).on( 'click', "a[href*='#elementor-action']", function () { //alert(111); /** Let's give the elementor some time to animate popup. */ setTimeout( function() { document.querySelectorAll(".elementor-popup-modal form.wpcf7-form:not(.elementor)"). forEach((e => { wpcf7.init(e), e.closest(".wpcf7").classList.replace("no-js", "js"), e.closest(".wpcf7").classList.add("mystyle"); })); }, 800 ); // END Timeout. } ); // END link click. } ); // END Document ready. </script> <?php } add_action( 'wp_footer', 'prefix_contact_form_custom_js', 100 );