Unable to read 'textContent' property


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


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.