Is there a more efficient way to display 50 different modals on one page without causing the HTML to become overwhelmingly large? I'm working on a project that requires multiple modal windows to open, sometimes triggering additional modals.
I am looking for a technical solution to handle these modal windows effectively. Rather than loading all 50 modal HTML codes at once when the page loads, I believe there must be a smarter approach. I've seen some websites with numerous modals where the modal div disappears from the DOM after it's closed, but I'm unsure of how this is achieved. It doesn't appear as though they insert all 50 modal HTML components into the initial page load.
Has anyone encountered a similar scenario dealing with massive modals on a webpage? Is there perhaps an HTML JS injection technique in use, storing modal templates and dynamically inserting the necessary HTML using JQuery upon button click events? And then removing the modal div from the DOM upon closing?
Any insights, solutions, or suggestions would be greatly valued.