如何使用jQuery获取整个页面的HTML? [英] How do I get the entire page's HTML with jQuery?
本文介绍了如何使用jQuery获取整个页面的HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 $(document).html()
,但是发生错误...是否有办法获取所有内容?
I used $(document).html()
, but that threw an error... is there a way to get everything?
推荐答案
您可以尝试:
$("html").html();
如果您还要捕获hmtl标签,可以将它们连接到html,如下所示: p>
If you want to also capture the hmtl tags you could concatenate them to the html like this:
function getPageHTML() {
return "<html>" + $("html").html() + "</html>";
}
这篇关于如何使用jQuery获取整个页面的HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文