If I have a
var t = document.createTextNode(text)
parent.appendChild(t);
Is it possible to simply update the contents of t
?
I would like to change the text inside the parent
without using removeChild
, createTextNode
and appendChild
. Why would I need this instead of just using innerHTML
? Because I don't want to update the contents of the element with HTML code and the text
may contain special characters, such as < or & which should be parsed by TextNode
's DOM methods.
Thanks,
Tom