I have an iframe without src attribute. I set it's HTML from JavaScript side.
The problem is that if I load a script that contains $("body").html() it returns the body's html of the parent document while I am expecting to get the iframe's body html.
How can I avoid such a behaviour?
I set the iframe HTML using:
$(".myResult").contents().find("html").html(myHtmlToLoad);
Here is a JSFIDDLE where I reproduced the issue. I am expecting the textarea value to return calling $(body).html() (inside of the iframe), but it returns the HTML of the entire page (that contains the iframe).