I have tried several of the suggestions posted here on other questions and on stackexchange, and nothing is working to my satisfaction.
I am trying to load dynamic
Probably an old post, I had a similar problem a time ago, i wanted to press a link, which would pass the href of a text file (or any other file) to an iframe inside a modal window, i solved like this:
function loadiframe(htmlHref) //load iframe
{
document.getElementById('targetiframe').src = htmlHref;
}
function unloadiframe() //just for the kicks of it
{
var frame = document.getElementById("targetiframe"),
frameHTML = frame.contentDocument || frame.contentWindow.document;
frameHTML.removeChild(frameDoc.documentElement);
}
LINK
So in this case you have only one modal, one iframe, which you load and unload.