I am trying to unwrap the contents of an html document string. I'm being given back a full html document from the froala rich text editor, that includes a head, title, and body tag which I want to remove.
The problem is that any selector I try gives me back an array that has a HTMLTitleElement, and then an array item for each root element in the document contents.
So, for example:
$('<!DOCTYPE html><html><head><title></title></head><body><h2>Summary</h2><div>Some content here</div></body></html>');
gives me back an array that has 3 elements: HTMLTitleElement, HTMLHeadingElement, HTMLDivElement.
I was hoping for a single HTMLBodyElement, or something that I could call .html()
on, in order to get the content entered into the editor without all the other html document wrappers.