XML DOM isEqualNode() method
Definition and usage
If the node is equal to the given node, isEqualNode() returns true, otherwise it returns false.
Syntax:
elementObject.isEqualNode(node)
Parameter | Description |
---|---|
node | Required. The node to be checked. |
Example
In all examples, we will use the XML file books.xml, as well as the JavaScript function loadXMLDoc().
The following code checks if two nodes are equal:
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[1];
y=xmlDoc.getElementsByTagName("book")[2];
document.write(x.isEqualNode(y)
);
The output of the above code:
false