且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用jQuery获取整个页面的HTML?

更新时间:2023-11-10 23:43:22

您可以尝试:

$("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>";
}