mpen mpen - 2 months ago 11
HTML Question

How to change textContent of TextNode in IE8?

textNode.innerHTML = 'abc'
and
textNode.textContent = 'abc'
do not appear to work in IE8. Per MSDN,
textContent
only works in IE9+.

So how can I change the text of a
TextNode
in IE8?

To be clear, I'm talking about an HTML node with
nodeType === 3
, I do not want nor care about changing the text of an HTML element.

Answer

textNode.nodeValue = 'abc' should work fine.