Search
Other Modals questions
Forum

J4 Beta - How to close modal is Javascript

John Bongiovanni's Avatar John Bongiovanni
How do I use the API to close a given model from an arbitrary point in JS code?
Peter van Westen's Avatar Peter van Westen ADMIN
You can use:
RegularLabs.Modals.close();
Please post a rating at the Joomla! Extensions Directory
John Bongiovanni's Avatar John Bongiovanni
How do I specify the modal I want closed?
Peter van Westen's Avatar Peter van Westen ADMIN
Why would you need to? There is just one modal open. So it will close that one.
Please post a rating at the Joomla! Extensions Directory
John Bongiovanni's Avatar John Bongiovanni
I open a modal which then opens another modal (iframe, if that matters). If I close the second modal, the first one is still there.

But you answwered my question. I can use the API call to close the first before I open the second.
Peter van Westen's Avatar Peter van Westen ADMIN
With the latest dev (beta) versions you can now optionally pass the link element to the close() function, to make it specifically close the modal connected to that link.
RegularLabs.Modals.close( document.querySelector('#id-of-my-modal-link') );
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription