innerText property of the
HTMLElement interface represents the "rendered" text content of a node and its descendants. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.
Node.textContent is somewhat similar to
innerText, but there are important differences between the two.
var renderedText = HTMLElement.innerText; HTMLElement.innerText = string;
A string representing the rendered text content of an element.
let string = 'Hello, I am pleased to see you!'; const para = document.querySelector('p'); para.innerText = string;
|HTML Living Standard
The definition of 'innerText' in that specification.
|Living Standard||Introduced, based on the draft of the innerText specification. See whatwg/html#465 and whatwg/compat#5 for history.|
|Basic support||Chrome Full support 4||Edge Full support 12||Firefox Full support 45||IE Full support 10||Opera Full support 9.6||Safari Full support 3||WebView Android Full support Yes||Chrome Android Full support Yes||Edge Mobile Full support 12||Firefox Android Full support 45||Opera Android Full support Yes||Safari iOS Full support 4||Samsung Internet Android Full support Yes|
- Full support
- Full support
This feature was originally introduced by Internet Explorer, and was formally specified in the HTML standard in 2016 after being adopted by all major browser vendors.