How to create a "close icon" reusable element to close any popup

Is it possible to create a “close icon” reusable element that I can place on any popup to close it when clicked?

Maybe some Javascript to simulate pressing Esc could work. As long as your popups don’t have the “Prevent Esc from closing” enabled.

Toolbox plugin has “Run javascript” action, have it run when the close button is pressed.
A quick google search someone says to do this:

function invokeEscKey() {
    var ev = document.createEvent('KeyboardEvent');
    ev.initKeyEvent(
        'keydown', true, true, window, false, false, false, false, 27, 0);
    document.body.dispatchEvent(ev);
}

Idk though I am not a coder

This topic was automatically closed after 70 days. New replies are no longer allowed.