We have a custom code for the elementors popups via Dashboard -> Templates -> Popups (see attached file)
But since popups that are created using Dashboard -> Popups belong to wd_popups and not pure elementor popups, there should be a method of the theme how to trigger the popups properly.
Could you please advise how to correctly trigger those type of the popups to appear on the button click?
jQuery(window).on(‘elementor/frontend/init’, function () {
var button = document.querySelector(‘.contactformpopuptest’);
if (button) {
button.addEventListener(‘click’, function (e) {
e.preventDefault();
if (
typeof elementorProFrontend !== ‘undefined’ &&
elementorProFrontend.modules &&
typeof elementorProFrontend.modules.popup !== ‘undefined’
) {
console.log(‘Popup module loaded:’, elementorProFrontend.modules.popup);
try {
elementorProFrontend.modules.popup.showPopup({ id: 29063 }); // ID of the elementor popup
} catch (err) {
console.error(‘Popup failed to open:’, err);
}
} else {
console.warn(‘Popup module is not available. Make sure Elementor Pro is active and the popup is published.’);
}
});
}
});
This reply was modified 4 weeks, 1 day ago by la.xtemos.acc.
To trigger the pop-up when you click on a specific button, you don’t need to use custom JavaScript code. Simply remove the code and use the “On selector click” trigger as shown in the screenshot https://gyazo.com/bd73ac3b12aee6185ba18c93d5a77ecc
In this case, your button should have a CSS class of my-custom-button.