I'm trying to read in the entire page's HTML (including the doctype) then remove a few parts of the page in order to pass it as a string via AJAX.
What I have so far is:
var page = doctype + document.documentElement.outerHTML;
This gives me the content that I want, but when I try to use jQuery's .remove()
function, I'm getting undefined is not a function
.
page.remove(".my-class");
I assume I'm doing something with the variable type wrong? How can I grab the full page source such that I can still manipulate it with jQuery?