var Message = document.getElementById('txtTest'); Message.innerText = 'With my last breath, I spit at thee';
(I’m pretty sure that quote is in one of those “Glad we’re getting a divorce” cards from Hallmark.)
The element I was trying to update was defined as so:
<span id="txtTest" />
And when I ran the script, I got this error:
Error: 'null' is null or not an object
Well, yes, null is in fact null, so what’s the problem?
Anyways, I was able to solve the issue by creating a closing tag for my SPAN:
Feel free to enlighten me on this, but to me, it seems odd.