X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM isEqualNode() Method

Element Object Reference Element Object

Example

Check if two list items in two different list are equal:

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

The result will be:

false

Try it yourself »


Definition and Usage

The isEqualNode() method checks if two nodes are equal.

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

  • They have the same Node Type
  • They have the same nodeName, NodeValue, localName, nameSpaceURI and prefix
  • They have the same childNodes with all the descendants
  • They have the same attributes and attribute values (the attributes does not have be in the same order)

Tip: Use the isSameNode() method to determine if two nodes are the same node.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The isEqualNode() method is supported in all major browsers.

Note: Internet Explorer 8 and earlier does not support this method.


Syntax

node.isEqualNode(node)

Parameters

Parameter Type Description
node Node object Required. The node you want to compare the specified node with

Return Value

Type Description
Boolean true if the two nodes are equal, otherwise false

Technical Details

DOM Version Core Level 3 Node Object


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook