var keys = document.getElementsByClassName("small_key");
for(i=0; i<keys.length; i++) {
keys[i].addEventListener("click", keyClick);
}
I have the code above and want to know how to write the function "keyClick" so that I know which one of all the elements that's clicked.
function keyClick(){}
This question is not duiplicated since the other question is for document.getElementById and this for document.getElementsByClass. With the difference, getElementById return one element while getElementsByClass returns one or more. I didn't know if it was the same way when you put more than one element with the same listener...