HTML DOM isEqualNode()Method
Examples
Check whether the list items of two different lists are equal:
var item1=document.getElementById("myList1").firstChild;
var item2=document.getElementById("myList2").firstChild;
item1.isEqualNode(item2);
var item2=document.getElementById("myList2").firstChild;
item1.isEqualNode(item2);
Output result:
false
Try it Yourself »
Definition and Usage
The isEqualNode() method is used to check whether two nodes are equal.
Two nodes are equal and return true if the following conditions are met:
- Have the same node type
- Have the same node name, node value, local name, namespace URI, and prefix.
- They have the same child nodes and all descendants
- Have the same attributes and attribute values (attributes do not need to be in the same order)
Tip:Usethe 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
| Parameter | Type | Description |
|---|---|---|
| node | Node object | Required. The two nodes to compare. |
Return Value
| Type | Description |
|---|---|
| Boolean | Returns true if the two nodes are equal, otherwise returns false. |
Technical Details
| DOM Version | Core Level 3 Node Object |
|---|
Other Extensions
Element Object