Unable to read 'textContent' property

advertisements

I am trying to create an animated logo inspiration : http://codepen.io/pavlunya/pen/OPmVem

I am getting error when I use document.getElementById instead of document.getElementsByTagName

Jsfiddle

Thanks in advance for help


The reason p is null is because document.getElementById returns a single dom node, not an array. You do not need the [0] at the end on line 4.