Home > jQuery > jQuery(string) create not valid DOM when string is html with newlines

jQuery(string) create not valid DOM when string is html with newlines

function jquery_from_html(data) {
		return $("<div id='inner' />").append(data);
}

or

remove javascript and head overhead
var htmlDOM = $("<div id='inner' />").append(html.replace(/<script [\s\S]*\/script>|<head [\s\S]*\/head>/img,""));

Categories: jQuery Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

17043 pages viewed, 0 today
11075 visits, 0 today
FireStats icon Powered by FireStats