JQuery | parseHTML() method Last Updated : 27 Apr, 2020 Comments Improve Suggest changes Like Article Like Report This parseHTML() Method in jQuery is used to parses a string into an array of DOM nodes. Syntax: jQuery.parseHTML(data [, context ] [, keepScripts ]) Parameters: The parseXML() method accepts three parameter that is mentioned above and described below: data: This parameter is the HTML string to be parsed. context : This parameter is the document element to serve as the context in which the HTML fragment will be created. keepScripts : This parameter is the boolean indicating whether to include scripts passed in the HTML string. Return Value: It returns the Array. Example 1: In this example, the parseHTML() Method a string is parsed into an array of DOM nodes. html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JQuery | parseHTML() method</title> <script src="https://code.jquery.com/jquery-3.4.1.js"></script> </head> <body style="text-align:center;"> <h1 style="color: green"> GeeksForGeeks </h1> <h3>JQuery | parseHTML() method</h3> <pre id="geek"> </pre> <script> var $geek = $( "#geek" ), str = "A <b>computer science portal</b> for <b>geeks</b>", html = jQuery.parseHTML( str ), nodeNames = []; $geek.append( html ); </script> </body> </html> Output: Example 2: In this example, the parseHTML() Method create an array of DOM nodes using an HTML string and insert it into a div. html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JQuery | parseHTML() method</title> <script src="https://code.jquery.com/jquery-3.4.1.js"></script> </head> <body style="text-align:center;"> <h1 style="color: green"> GeeksForGeeks </h1> <h3>JQuery | parseHTML() method</h3> <div id="geek"> </div> <script> var $geek = $( "#geek" ), str = "A <b>computer science portal</b> for <b>geeks</b>", html = jQuery.parseHTML( str ), nodeNames = []; $geek.append( html ); $.each( html, function( i, el ) { nodeNames[ i ] = "<li>" + el.nodeName + "</li>"; }); $geek.append( "<h3>Node Names:</h3>" ); $( "<b></b>" ) .append( nodeNames.join( "" ) ) .appendTo( $geek ); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article JQuery | parseHTML() method S SHUBHAMSINGH10 Follow Improve Article Tags : Web Technologies JQuery jQuery-Methods Similar Reads JQuery | parseXML() Method This parseXML() Method in jQuery is used to parse a string into an XML document. Syntax: jQuery.parseXML( data ) Parameters: This method accept single parameter which is mentioned above and described below: data: This parameter holds the well-formed XML string to be parsedd. Return Value: It returns 2 min read jQuery param() method The param() method in jQuery is used to create a serialized representation of an object. Syntax: $.param( object, trad )Parameters: This method accepts two parameters as mentioned above and described below: object: It is a mandatory parameter that is used to specify an array or object to serialize.t 2 min read JQuery | parseJSON() method This parseJSON() method in jQuery takes a well-formed JSON string and returns the resulting JavaScript value. Syntax: jQuery.parseJSON( json )Parameters: The parseXML() method accepts only one parameter that is mentioned above and described below: json: This parameter is the well-formed JSON string 2 min read jQuery text() Method This method is used to set or return the text content of the element. While setting the content, it overwrites the content of all the matched elements. The returned content of text method() is used to return the text content of all matched elements. Syntax: Return text syntax: $(selector).text() Set 2 min read JQuery | type() method This type() Method in jQuery is used to determine the internal JavaScript [[Class]] of an object. Syntax: jQuery.type( obj ) Parameters: The type() method accepts only one parameter that is mentioned above and described below: obj: This parameter is the object to get the internal JavaScript [[Class] 2 min read Like