HTML Javascript get textNode by id tagname anything?
Is there anyway to assign an id to a textNode and then retrieve that text node via that id? I've tried several different ways and keep getting errors saying cannot get property of null. My code looks something like this... var myDiv = document.createdElement('div'); myDiv.id = "textContainer"; var textNode = document.createdTextNode("some text"); textNode.id = "descriptionText"; myDiv.appendChild(textNode); Works fine to this point; it displays on the page. Later I try to modify that text node and that's where I'm getting the errors. var tempNode = document.getElementById(descriptionText);