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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
UPDATE: This answer (the text below) was wrong despite being the accepted answer. Instead of comparing the IDs use an equality check of the elements:
element1 === element2If the Ids are the same, they cannot be different. If the Ids are different they cannot be the same. So if you have both Ids you can just compare the two Ids.