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:
- They have the same nodeType
- They have the same nodeName
- They have the same nodeValue
- They have the same nameSpaceURI
- They have the same childNodes with all the descendants
- They have the same attributes and attribute values
- They have the same localName and prefix
See Also:
Syntax
element.isEqualNode(node)
or
node.isEqualNode(node)
Parameters
Parameter | Description |
node | Required. The node to compare. |
Return Value
Type | Description |
Boolean | true 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.