The 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.

Note: Node.textContent is somewhat similar to innerText, but there are important differences between the two.

Syntax

var renderedText = HTMLElement.innerText;
HTMLElement.innerText = string;

Return value

A string representing the rendered text content of an element.

Example

This example uses JavaScript to change the text of a paragraph.

let string = 'Hello, I am pleased to see you!';
const para = document.querySelector('p');

para.innerText = string;

Specification

Specification Status Comment
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.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 4Edge Full support 12Firefox Full support 45IE Full support 10Opera Full support 9.6Safari Full support 3WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support 12Firefox Android Full support 45Opera Android Full support YesSafari iOS Full support 4Samsung Internet Android Full support Yes

Legend

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.

See also

Document Tags and Contributors

Last updated by: mfluehr,