HTML DOM isEqualNode() method
Example
Check whether list items in two different lists are equal:
var item1=document.getElementById("myList1").firstChild;
var item2=document.getElementById("myList2").firstChild;
item1.isEqualNode(item2);
Output result:
false
Try it »
Definition and Usage
The isEqualNode() method is used to check whether two nodes are equal.
Two nodes are equal and return true if they meet the following conditions:
- They have the same node type
- The same node name, node value, local name, namespace URI, and prefix.
- They have the same child nodes as all of their descendants
- They have the same attributes and attribute values (attributes are not required to be in the same order)
**Note:** Use the isSameNode() methodto determine whether two nodes are the same.
Browser support





All major browsers support the isEqualNode() method
Note: Internet Explorer 8 and earlier IE versions do not support this method.
Syntax
node
.isEqualNode(
node
)
Parameters
| Parameters | Type | Description |
|---|---|---|
| node | Node object | Required. The two nodes to compare. |
Return Value
| Type | Description |
|---|---|
| Boolean | Returns true if the two nodes are the same, otherwise returns false. |
Technical Details
| DOM version | Core Level 3 Node Object |
|---|
Element object