Adding event listeners to multiple elements

If you want to add an event listener to several controls you have to…
object.addEventListener("click", myScript);
So do you have to get the obj collection and loop over it?

I did this in the end which seems to do the trick:

    var modals = document.getElementsByName("deleteBtn");
    if (modals) {
      for (var i=0; i < modals.length; i++) {
        modals[i].addEventListener("click", showModal);

Didn’t need that code in the end. I passed (this) as a parameter in the onclick function to get access to the element attributes.