Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM isEqualNode method

HTML DOM isEqualNode() method

Element Object Reference Element object

Example

Check whether list items in two different lists are equal:

var item1=document.getElementById("myList1").firstChild;

var item2=document.getElementById("myList2").firstChild;

item1.isEqualNode(item2);

Output result:

false

Try it »


Definition and Usage

The isEqualNode() method is used to check whether two nodes are equal.

Two nodes are equal and return true if they meet the following conditions:

**Note:** Use the isSameNode() methodto determine whether two nodes are the same.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the isEqualNode() method

Note: Internet Explorer 8 and earlier IE versions do not support this method.


Syntax

node

.isEqualNode(

node

)

Parameters

Parameters Type Description
node Node object Required. The two nodes to compare.

Return Value

Type Description
Boolean Returns true if the two nodes are the same, otherwise returns false.

Technical Details

DOM version Core Level 3 Node Object

Element Object Reference Element object