HTML DOM isEqualNode() Method

Element Object Reference Element Object


Check if two list items in two different lists are equal:

var item1 = document.getElementById("myList1").firstChild;
var item2 = document.getElementById("myList2").firstChild;
var x = item1.isEqualNode(item2);

The result of x could be:


Try it yourself »

Definition and Usage

The isEqualNode() method checks if two nodes are equal.

Two nodes are equal if all the following conditions are true:

  • They have the same Node Type
  • They have the same nodeName, NodeValue, localName, nameSpaceURI and prefix
  • They have the same childNodes with all the descendants
  • They have the same attributes and attribute values (the attributes does not have be in the same order)

Tip: Use the isSameNode() method to determine if two nodes are the same node.

Browser Support

The numbers in the table specify the first browser version that fully supports the method.

isEqualNode() Yes 9.0 Yes Yes Yes



Parameter Values

Parameter Type Description
node Node object Required. The node you want to compare the specified node with

Technical Details

Return Value: A Boolean, returns true if the two nodes are equal, otherwise false
DOM Version Core Level 3 Node Object

Element Object Reference Element Object


Color Picker