The innerHTML property is used to read or set the HTML code within a node.
When the outerHTML property is used to read or set HTML code, the node itself is included.
The Textcontent property is used to read or set the text content that the node contains.
The InnerText property and the Outertext property have different values when reading the text content of an element node. The difference is that when you set the Text property of a node, the Outertext property causes the original element node to be replaced by the text node. Note that innertext is a non-standard property and Firefox does not support it.
1.innerText is affected by CSS, Textcontent does not have this problem. For example, if a CSS rule hides a piece of text, innertext does not return the text, and Textcontent returns.
The text returned by 2.innerText will filter out spaces, line breaks, and enter, and Textcontent will not
The 3.innerText attribute is not part of the DOM Standard, and the Firefox browser does not even deploy this property, and Textcontent is part of the DOM standard.
The above is the whole content of this article, I hope to learn to familiarize you with JavaScript can help.
innerHTML property, outerHTML property, Textcontent property, innertext attribute Difference