HTML DOM Element isEqualNode()

Example

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);
Try it Yourself »

Description

The isEqualNode() returns true if two elements (or nodes) are equal.

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


Syntax

element.isEqualNode(node)
or
node.isEqualNode(node)

Parameters

Parameter Description
node Required.
The node to compare.

Return Value

Type Description
Booleantrue if the nodes are equal, otherwise false.

Browser Support

element.isEqualNode() is a DOM Level 3 (2004) feature.

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.