How may I check if 2 Dom element are same.
Form example
var element1 = document.getElementById("abc"); var element2 = document.getElementById("abc");
Now how should I chekc that these 2 elements are equal?
Thanks
element1
and element2
are references to the same place in the DOM tree. Just check
if( element1 == element2 ) { alert("same") ; }
Check out the API for DOM nodes. It seems like you could use isEqualNode
to achieve this.
https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With