/

HTML / CSS / JavaScript Tutorial

JavaScript DOM HTML method: isSameNode()

[this page | pdf | back links]

The isSameNode() method (when applied to HTML elements in the JavaScript DOM) returns true if two elements / nodes are the same (i.e. not just equal but also computationally refer to the same node), otherwise returns false.

 

Some major browsers no longer support this method, so it is more robust to use the identically equal operator ===.

 

It has the following syntax with the following parameters. It returns a Boolean as above.

 

element.isSameNode(node)

 

Parameter

Required / Optional

Description

node

Required

Node object which is compared to the element (method can also be applied to a node object)

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile