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)

Return Value

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

Parameters

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


© West Wind Technologies, 1996-2024 • Updated: 12/26/15
Comment or report problem with topic