HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>This is paragraph 1</p> <p>This is paragraph 2</p> <p>This is paragraph 1</p> <button onclick="p1ANDp1()">Compare 1 & 1</button> <button onclick="p1ANDp2()">Compare 1 & 2</button> <button onclick="p1ANDp3()">Compare 1 & 3</button> <script> var p1 = document.getElementsByTagName("p")[0]; var p2 = document.getElementsByTagName("p")[1]; var p3 = document.getElementsByTagName("p")[2]; function p1ANDp1(){ alert(p1.isEqualNode(p1)); } function p1ANDp2(){ alert(p1.isEqualNode(p2)); } function p1ANDp3(){ alert(p1.isEqualNode(p3)); } </script> </body> </html>
OUTPUT
×

Save as Private