Does jQuery strip some html elements from a string when using .html()?

后端 未结 4 1512
遥遥无期
遥遥无期 2020-12-01 18:20

I have a var that contains a full html page, including the head, html, body, etc. When I pass that string into the .html() function, jQuery strips out all those elements, s

4条回答
  •  死守一世寂寞
    2020-12-01 18:45

    Here is a solution, which will include the body, head and other attributes: mydoc = document.getElementById('NAME_OF_PREVIEW_FRAME').contentWindow.document; mydoc.write(HTML_CODE); mydoc.close();

提交回复
热议问题