Difference between textContent and innerText Last Updated : 14 Dec, 2020 Comments Improve Suggest changes Like Article Like Report 1. textContent : This property is used to set or return the text value of the selected node and all its descendants. While setting the textContent property, any child nodes are removed. It is replaced by a single Text node containing the specified string. Syntax : To set the text of node - node.textContent = text To return the text of node - node.textContent 2. innerText : This property also sets or returns the text value of the selected node and all its descendants. However, there are some differences shown using the following example. [tabby title="HTML"] HTML <!DOCTYPE html> <html> <head> <title> Differences between innerText and textContent. </title> </head> <body> <h3>Differences between innerText & textContent.</h3> <p id="demo"> This element has extra spacing and contains <span>a span element</span>.</p> <button onclick="getInnerText()">Get innerText</button> <button onclick="getTextContent()">Get textContent</button> <p id="demo"></p> <script> function getInnerText() { alert(document.getElementById("demo").innerText) } function getTextContent() { alert(document.getElementById("demo").textContent) } </script> </body> </html> [/tabbyending] Output : Before clicking any buttons : After clicking on innerText button : After clicking on textContent button : The innerText property returns the text, without spacing and the textContent property returns the text along with spacing. Other differences between innerText : Sl No. innerText textContent 1.It returns the visible text contained in a node.It returns the full text.2.It is much more performance-heavy, as it requires layout information to return the result.It is not so much performance-heavy, as it doesn't requires layout information to return the result.3.It is defined only for HTMLElement objects.It is defined for all Node objects.4.This property is not supported in IE9 and earlier.This property is not supported in Internet Explorer 8 and earlier. Comment More infoAdvertise with us Next Article Difference between textContent and innerText A aktmishra143 Follow Improve Article Tags : Difference Between Web Technologies HTML HTML-Basics Similar Reads Difference between textContent and innerHTML The textContent and innerHTML are properties of JavaScript. However, there are differences in the way the specified text is handled in JavaScript. Let us take a look at the syntax of both of these properties.Syntax:Let elem be a JavaScript variable that holds an element that is selected from the pag 2 min read Difference between Rich text and Plain text What is Text.:- Collection of words or letters is called as text. This is a plain text-Geeks for Geeks This is a rich text- Geeks for Geeks It is clear from the above two types of text that what we are dealing with now lets see them one by one in detail and the difference between them. 1. PLAIN TEXT 5 min read Difference between innerText and innerHTML innerText and innerHTML are both properties of JavaScript. However, there are differences in which the text is handled. Let us check the syntax of the two and then take an example to look at the differences. Syntax: Let us assume that we have a JavaScript variable called x.let x = document.getElemen 1 min read Difference between Texting and Email 1. Texting : Texting is the method of communication that includes the sending and receiving of short messages known as texts. It is done between two or more mobile devices. It is basically the act of composing and sending messages to one or more mobile devices over the cellular network meaning anyon 2 min read Difference between Texting and Messaging 1. Texting : Texting is one of the oldest method of communication, and now a days it is less used after messaging came into market. With the help of texting initially individuals only communicate with each other via sending text messages to each other. For sending and receiving text messages no appl 3 min read Like