JQuery | isXMLDoc() Method
This isXMLDoc() Method in jQuery is used to check to see if a DOM node is within an XML document.
Syntax:
jQuery.isXMLDoc( node )
Parameters: This method accept a single parameter which is mentioned above and described below:
- node: This parameter holds the DOM node that will be checked to see if it’s in an XML document.
Return Value: It returns the boolean value.
Below examples illustrate the use of isXMLDoc() method in jQuery:
Example 1:
<!DOCTYPE html>
< html >
< head >
< meta charset = "utf-8" >
< title >JQuery | isXMLDoc() method</ title >
< script src =
</ script >
</ head >
< body style = "text-align:center;" >
< h1 style = "color: green" >
GeeksforGeeks
</ h1 >
< h3 >JQuery | isXMLDoc() method</ h3 >
< b >Value Return by isXMLDoc : </ b >
< br >
< b id = "geek" >
</ b >
< script >
var str = "A computer science portal for geeks",
html = jQuery.parseHTML(str);
document.getElementById("geek").innerHTML =
jQuery.isXMLDoc(html);
</ script >
</ body >
</ html >
|
Output:
Example 2:
<!DOCTYPE html>
< html >
< head >
< meta charset = "utf-8" >
< title >JQuery | isXMLDoc() method</ title >
< script src =
</ script >
</ head >
< body style = "text-align:center;" >
< h1 style = "color: green" >
GeeksforGeeks
</ h1 >
< h3 >JQuery | isXMLDoc() method</ h3 >
< br >
< b >Value Return By isXMLDoc :</ b >
< br >
< b id = "geek" >
</ b >
< script >
var xml = "< rss version = '2.0' >"+
"< channel >"+
"< body >String : parseXML</ body >"+
"</ channel >"+
"</ rss >",
xmlDoc = $.parseXML(xml);
document.getElementById("geek").innerHTML =
jQuery.isXMLDoc(xmlDoc);
</ script >
</ body >
</ html >
|
Output:
Last Updated :
30 Apr, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...