开发者

body html of iframe

Hi my code returns all the html of the iframe. I would like just the body ht开发者_StackOverflow中文版ml. Any one know how to amend to suit?

Code:

alert( $("#uploaderIframe").contents()[0].documentElement.innerHTML );


var iframeHtml = $("#uploaderIframe").contents()[0].documentElement.innerHTML;
var bodyHtml = $(iframeHtml).find("body").html();
alert( bodyHtml );

.. probably creates a new DOM node from the innerHTML of the iFrame - I actually suspect that $(iframeHtml).find("body") is an empty jQuery object.

Try

var bodyHtml = $('#uploaderIframe').contents().find("body").html()

Ref: Traversing/contents


Try this:

iframeHtml = $("#uploaderIframe").contents()[0].documentElement.innerHTML;
bodyHtml = $(iframeHtml).find("body");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜