HTML DOM Element isEqualNode() Method
- Previous Page isDefaultNamespace()
- Next Page isSameNode()
- Back to Top ອາລົມ HTML DOM Elements
Definition and Usage
isEqualNode()
The method checks if two nodes are equal.
If two elements (or nodes) are equal,isEqualNode()
Returns true
.
If all of the following conditions are true, the two nodes are equal:
- 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 and all descendants
- They have the sameAttributesand attribute values
- They have the same localName and prefix
Tip:Please use isSameNode() Method To check if two nodes are the same node.
See also:
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);
Syntax
element.isEqualNode(node)
or
node.isEqualNode(node)
Parameter
Parameter | Description |
---|---|
node | Required. The node to be compared. |
Return Value
Type | Description |
---|---|
Boolean | If two nodes are equal, it returns true, otherwise it returns false. |
Browser Support
element.isEqualNode()
Is DOM Level 3 (2004) feature.
All browsers fully support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous Page isDefaultNamespace()
- Next Page isSameNode()
- Back to Top ອາລົມ HTML DOM Elements