79339586

Date: 2025-01-08 14:44:38
Score: 1
Natty:
Report link

Elementor popup events today support just jQuery. If you need a Vanilla Js solution check this: https://eduardovillao.me/handle-elementor-popup-events-without-jquery/

// Select the <body> element
const body = document.body;

// Create a MutationObserver
const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        // Check if new nodes were added
        if (mutation.type === "childList") {
            mutation.addedNodes.forEach((node) => {
                // Check if the added node is an Elementor popup modal
                if (node.classList && node.classList.contains("elementor-popup-modal")) {
                    console.log("Elementor popup detected:", node);
                    // Add your custom logic here
                }
            });
        }
    });
});

// Configure the observer to monitor the <body>
observer.observe(body, { childList: true });

// Stop observing when no longer needed (optional)
// observer.disconnect();
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Eduardo Villão