Misc Parsehtml
# jQuery.parseHTML() Method
[jQuery Misc Methods](#)
## Example
Create an array of DOM nodes from an HTML string and insert it into a div.
" + el.nodeName + " "; }); // Insert the node names $log.append("
attribute. Callers should avoid this and sanitize or escape any untrusted input from sources like URLs, cookies, etc., to prevent this. For future compatibility, when the keepScripts parameter is omitted or false, callers should not rely on the ability to run any script content.
* * *
## Syntax
_$_.parseHTML( htmlString [, context ] [, keepScripts ] )
| Parameter | Description |
| :--- | :--- |
| _htmlString_ | String type. The HTML string to parse and convert into an array of DOM nodes. |
| _context_ | Element type. Specifies in which Document to create the elements. Defaults to the current document's document. |
| _keepScripts_ | Boolean type. Specifies whether to include scripts in the passed HTML string. Defaults to false. |
* * jQuery Misc Methods](#)
$(function(){var $log = $("#log"), str = "hello, my name is jQuery.", html = $.parseHTML(str), nodeNames = []; //Add the parsed HTML $log.append(html); //Collect the node names of the parsed HTML $.each(html, function(i, el){nodeNames = "
YouTip