Get the whole document's html with JavaScript/JQuery

前端 未结 8 1130
无人及你
无人及你 2021-02-14 16:54

I know it\'s already discussed here, but there were no solution to get the whole document (including doctype).

$(document).html(); returns null

8条回答
  •  不知归路
    2021-02-14 17:36

    I'm not sure about getting the complete doc.but what you can do is,you can get the content of html tag seprately and doctype seprately.

    $('html').html() for content and document.doctype for getting the doctype

提交回复
热议问题