getBodyFromHtmlDocument(html)

Extracts the contents of the <body> tag in from a full HTML document string. Useful when you need to load the content of the document in jQuery which cannot load a full HTML document but needs an HTML fragment instead.

$.get("somepage.html", function(html){
   var body = getBodyFromHtmlDocument(html);
   
   // create something that jquery can work with
   $el = $("<div>" + body + "</div>");
});
getBodyFromHtmlDocument(html)

Returns

String content of what's inside <body> tag of the document passed.

Parameters

html
The full HTML document which contains a <body> tag.