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

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

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

11条回答
  •  北海茫月
    2020-11-22 07:39

    In simple words:

    1. innerText will show the value as is and ignores any HTML formatting which may be included.
    2. innerHTML will show the value and apply any HTML formatting.

提交回复
热议问题