How to compare two HTML elements

前端 未结 4 1499
梦毁少年i
梦毁少年i 2020-12-01 06:19

How can we compare two HTML elements whether they are identical or not ?

I tried this thing but no luck

Hi this is sachin ten
4条回答
  •  情话喂你
    2020-12-01 06:57

    How does this codes?

    var d1 = document.createElement("div");
    d1.appendChild(divs.get(0));
    var d2 = document.createElement("div");
    d2.appendChild(divs.get(1));
    if (d1.innerHTML == d2.innerHTML) ?
    

提交回复
热议问题