VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-createtextnode-method/

⇱ HTML DOM createTextNode() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM createTextNode() Method

Last Updated : 11 Jul, 2025

The createTextNode() method is used to create a TextNode which contains an element node and a text node. It is used to provide text to an element. This method contains the text values as parameters which are of string type.

Syntax:

document.createTextNode( text )

Parameters: This method accepts single parameter text which is mandatory. It is used to specify the text of the text node.

Example: In this example, we will use createTextNode() method

Output:

👁 Image

Supported Browsers: The browser supported by DOM createTextNode() Method  are listed below: 

Comment
Article Tags: