VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-innertext-property/

⇱ HTML DOM innerText Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM innerText Property

Last Updated : 15 Jun, 2023

The DOM innerText Property is used to set or return the text content of a specified node and its descendants. This property is very similar to the text content property but returns the content of all elements, except for <script> and <style> elements. 

Syntax: It is used to set the innerText property.

node.innerText = text 

Return Value: It returns a string value that represents the text content of the element along with its descendants. 

Example 1: In this example, we will see DOM innerText Property

Output: 

👁 Image
 

Example 2:  In this example, we will see DOM innerText Property

Output: 

👁 Image
 

Supported Browsers: The browser supported by DOM innerText property are listed below:

  • Google Chrome 1.0 and above
  • Edge 12.0 and above
  • Internet Explorer 5.5 and above
  • Firefox 45.0 and above
  • Opera 9.6 and above
  • Safari 3.0 and above
Comment