JavaScript Error: “.addEventListener is not a function ” why this error occur

Solution:

Because you put the JavaScript Code on wrong place. This error is occur because .addEventListener function are not accessed.The solution is very simple only cut all the JavaScript code and pasted at the end of HTML file. 

Comments