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 »
The isEqualNode()
returns true
if two elements (or nodes) are equal.
Two nodes are equal if all of the following conditions are true:
element.isEqualNode(
node)
node.isEqualNode(
node)
Parameter | Description |
node | Required. The node to compare. |
Type | Description |
Boolean | true if the nodes are equal, otherwise false . |
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 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!