How do I add an event listener to multiple buttons and get the value of each one depending on the one clicked. Eg:
Like Lucas's answer, this version will use classes instead of ID to select each button, and it will use a basic for loop.
The JS
var buttons = document.querySelectorAll(".btn").length;
for (var i = 0; i < buttons ; i++) {
document.querySelectorAll(".btn")[i].addEventListener("click", function() {
alert("Button Clicked");
});
}