I often build applications with ajax and many layers (to create/edit/delete different kind of content for example - or show message boxes or something). Some of this layers are much complex in html an js. but i keep asking my self whats the best way to handle the layer elements.
Sometimes i have a template and use cloneNode and sometimes i create the html structure with js (createElement) - depends on complexity. But what's the best way to close the layer?
i've often build it in both ways but i never seen advantages or disadvantages in practice. So what's the best practice?
If your website is getting too massive, an <iframe> could be a viable solution depending on your application.