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 is
the text as a string.
s
To attach the returned text node to an element node
T, use:
E
E.appendChild(T)