innerhtml, innerText, textContent

Element.innerHTML Property set or get descendant elements of HTML syntax representation.

 

Note: If a  <div><span>or  <noembed> node has a child text node that contains the character  (&), (<),  or (>)innerHTML these characters are returned as & amp ;, & lt; and & gt;.

 

 

Use Node.textContent  can get a correct copy of the text of the content of these nodes.

 

textContent content will get all the elements, including the `<script>` and `<style>` elements, innerText will not get `<script>` and `<style>` element

innerText cause reflow,

Guess you like

Origin www.cnblogs.com/chargeworld/p/11222291.html