Is there a way in JS to get the entire HTML within the html tags, as a string?
document.documentElement.??
Get the root <html>
element with document.documentElement
then get its .innerHTML
:
const txt = document.documentElement.innerHTML;
alert(txt);
or its .outerHTML
to get the <html>
tag as well
const txt = document.documentElement.outerHTML;
alert(txt);