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

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

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

11条回答
  •  萌比男神i
    2020-11-22 07:43

    innerText property sets or returns the text content as plain text of the specified node, and all its descendants whereas the innerHTML property gets and sets the plain text or HTML contents in the elements. Unlike innerText, inner HTML lets you work with HTML rich text and doesn’t automatically encode and decode text.

提交回复
热议问题