HTML DOM textContent Property Last Updated : 13 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The textContent property in HTML is used to set or return the text content of the specified node and all its descendants. This property is very similar to nodeValue property but this property returns the text of all child nodes.Syntax: It is used to set the text of node. node.textContent = textIt is used to return the text of node. node.textContent Property Value: It contains single value text which contains node the node content. Return Value: It returns a string value which represents the text content of a particular node node and all descendants. Example 1: html <!DOCTYPE html> <html> <head> <title> HTML DOM textContent Property </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM textContent Property</h2> <button id = "geeks" onclick = "MyGeeks()"> Submit </button> <p id = "sudo"></p> <script> function MyGeeks() { var text = document.getElementById("geeks").textContent; document.getElementById("sudo").innerHTML = text; } </script> </body> </html> Output: Before Click on the button: After Click on the button: Example 2: html <!DOCTYPE html> <html> <head> <title> HTML DOM textContent Property </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM textContent Property</h2> <p id = "geeks" onclick = "MyGeeks()"> Hello Geeks! </p> <script> function MyGeeks() { document.getElementById("geeks").textContent = "Welcome to GeeksforGeeks!"; } </script> </body> </html> Output: Before Click on the text: After Click on the text: Supported Browsers: The browser supported by DOM textContent property are listed below: Google Chrome 1Edge 12Internet Explorer 9Firefox 1Opera 9Safari 3 Create Quiz Comment V vijay_raj Follow 0 Improve V vijay_raj Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like