Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML | DOM createTextNode() Method

Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 13 Jul, 2022
Improve Article
Save Article

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

document.createTextNode( text )

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


<!DOCTYPE html>
        <title>DOM createTextNode() Method</title>
            h1, h2 {
            body {
        <h2>DOM createTextNode() Method</h2>
        <button onclick="geeks()">Submit</button>
            function geeks() {
                var x =


Before Clicking on Button:

After Clicking on Button:

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

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5
  • Firefox 1
  • Opera 7
  • Safari 1


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!