actions.js:2 Uncaught TypeError: Cannot read property 'addEventListener' of undefined code example

Example: Uncaught TypeError: Cannot read property 'addEventListener' of undefined

1)Check you placed .before the class
Example:
document.getElementsByClassName('.yourclassname') //.before class name is wrong
the code should be document.getElementsByClassName('yourclassname');
2)Check the spelling for addEventListener 
///dont feel embrassed because i always do these mistakes eventhough i used this property it 10000 times