This method is used to create a new text node within the HTML/XML document.
Description
The .createTextNode()
method is used to create a new text node within the HTML/XML document.
Syntax
text = document.createTextNode(data);
where,
- text is a Text node.
- data is a string containing the data to be put in the text node.