Next / Previous / Contents / TCC Help System / NM Tech homepage

12.2. Document.createTextNode()

To attach text to an element, first build a Text node by using the .createTextNode constructor on a Document instance D:

D.createTextNode(s)

where s is the text as a string.

To attach the returned text node T to an element node E, use:

E.appendChild(T)