Is there any way to copy iframe's content into popup window in jQuery?
$(popUpWindow.document).append($('#iframe1').contents());
$(popUpWindow.document).append($('#iframe1').contents().find('body').html());
All of them are not working!
Thanks
Is there any way to copy iframe's content into popup window in jQuery?
$(popUpWindow.document).append($('#iframe1').contents());
$(popUpWindow.document).append($('#iframe1').contents().find('body').html());
All of them are not working!
Thanks
Please mention which popup you are using and by content what do you mean.
Example for jquery-ui popup (dialog)
HTML:
<div id="myDialog" >
<p>default dialog</p>
</div>
jQuery:
$(function() {
$( "#myDialog" ).dialog();
$( "#myDialog p" ).html($("iframe").contents().find("body").html());
});
If all that you need to do is actually obtain the iframe contents, you can try something a bit more low level than jquery: raw javascript!
var getIframeContent = function (id) {
var iframe = document.getElementById(id);
return iframe.contentWindow.document.body.innerHTML;
}
But I would imagine something similar is going on underneath the hood in JQuery.