var elements = document.getElementsByClassName('my-class');
Array.prototype.forEach.call(elements, function(element) {
emement.addEventListener('click', function(e) { /* ... */ });
});
var elements = document.getElementsByClassName('my-class');
for (var i = 0; i < emements.length; i++) {
elements[i].addEventListener('click', function(e) { /* ... */ });
}
ES6:const elements = document.getElementsByClassName('my-class');
for (let element of elements) {
emement.addEventListener('click', e => { /* ... */ });
}