[英]Get contents of iframe in jquery and replace it to the parent html
我正在嘗試從 iframe 獲取全部內容並將其替換為父 html。 示例代碼如下
$('#textEditor').load(function(){
var test = $('#textEditor').contents().find('html').html();
alert(test);
$('html').html(test); // Does not work in IE7
$('body').html(test); // Works in IE7
});
我如何訪問 html 標簽並在 IE7 中寫入內容?
$('html').html("asdfasdfsad"); // This doesnt work in IE7
不知道為什么這在 IE 7 中不起作用,但我可以給你一個替代解決方案。 那就是通過它的 url 來調用頁面。 所以你更換你的
var test = $('#textEditor').contents().find('html').html();
用 jquery 代替加載 URL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.