element.innerText property gets or sets the text content of the specified node, and all its descendants.
Note: If you set the innerText property to a specified element, all child nodes of that specified element are removed and replaced by a single Text node containing the specified string.
element.innerText is easily confused with node.textContent, but there are important differences between the two.
- innerText will not return the text of elements that are hidden with CSS, but textContent will do.
- textContent returns the text content of all elements, whereas, innerText returns the content of all elements, except for <style> and <script> elements.
Get the innerText
|String||Returns a DOMString representing the rendered text content of an element.|
Set the innerText
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.