Difference between innerText, innerHTML, and childNodes[].value?

前端 未结 11 1439
别跟我提以往
别跟我提以往 2020-11-22 06:57

What is the difference between innerHTML, innerText and childNodes[].value in JavaScript?

11条回答
  •  [愿得一人]
    2020-11-22 07:47

    In terms of MutationObservers, setting innerHTML generates a childList mutation due to the browsers removing the node and then adding a new node with the value of innerHTML.

    If you set innerText, a characterData mutation is generated.

提交回复
热议问题