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

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

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

11条回答
  •  情话喂你
    2020-11-22 07:42

    InnerText will only return the text value of the page with each element on a newline in plain text, while innerHTML will return the HTML content of everything inside the body tag, and childNodes will return a list of nodes, as the name suggests.

提交回复
热议问题