mozilla

Node.isEqualNode()

The Node.isEqualNode() tests whether two nodes are equal.

Syntax

var isEqualNode = node.isEqualNode(arg);
  • arg: The node to compare equality with.

Example

If the first div element has the id targetEl in document, true will be logged in the console.

var targetEl = document.getElementById("targetEl");
var firstDiv = document.getElementsByTagName("div")[0];

console.log( targetEl.isEqualNode(firstDiv) );

Specification

Document Tags and Contributors

Last updated by: fscholz,