You have two ways to do it :
The easy way
Use jQuery, it's a JS library which will be really usefull for everything, and it's really easy to learn because it is JS.
You'll be able to do $(".myClass").click(function(){ // Code... });
to select all elements with the myClass class (It uses CSS selectors).
The pure JS
Get the elements by tag, then you'll get an array and for each element in the array test if they have a certain class (give a special class to the elements you want to select).
If they have the class, apply the addEventListener
.
:)