Add event listener to multiple buttons with the same class

PHOTO EMBED

Wed Jul 13 2022 16:39:59 GMT+0000 (Coordinated Universal Time)

Saved by @dqmeek #js #vanilla

btns = document.getElementsByClassName("saveBtn");
for (var i = 0; i < btns.length; i++) {
  btns[i].addEventListener("click", function () {
    //Add function here
  });
}
content_copyCOPY

https://www.thiscodeworks.com/add-event-listener-to-multiple-buttons-with-the-same-class-javascript/5efa75c76c23bc0014be6336