I know it\'s already discussed here, but there were no solution to get the whole document (including doctype).
$(document).html(); returns null
$(document).html();
null
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
$('html').html() for content