Amanda Montcrieff

Scroll to Top
Contact Representative
Preferred Contact Method
CC:
// Function to inject the reCAPTCHA token function injectWPFormsRecaptchaToken() { if (typeof grecaptcha === 'undefined' || typeof wpforms_recaptcha === 'undefined') { return; } grecaptcha.ready(function() { grecaptcha.execute(wpforms_recaptcha.site_key, { action: 'wpforms' }) .then(function(token) { var field = jQuery('input[name="wpforms[recaptcha]"]'); if (field.length) { field.val(token); console.log('WPForms reCAPTCHA token injected:', token.substring(0, 20) + '...'); } else { console.log('WPForms reCAPTCHA field not found'); } }) .catch(function(err) { console.log('reCAPTCHA execute error:', err); }); }); } // Trigger 1 - Elementor popup event jQuery(document).on('elementor/popup/show', function() { console.log('Elementor popup opened, injecting token...'); // Small delay to ensure popup DOM is fully rendered setTimeout(injectWPFormsRecaptchaToken, 500); }); // Trigger 2 - Fallback: watch for the popup becoming visible var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.target.id === 'elementor-popup-modal-3596' && mutation.target.style.display !== 'none') { console.log('Popup visibility change detected, injecting token...'); setTimeout(injectWPFormsRecaptchaToken, 500); } }); }); jQuery(document).ready(function() { var popupEl = document.getElementById('elementor-popup-modal-3596'); if (popupEl) { observer.observe(popupEl, { attributes: true, attributeFilter: ['style', 'class'] }); console.log('Popup observer attached'); } else { console.log('Popup element not found for observer'); } });