var elems = document.getElementsByClassName('delButton');
for(i=0; i<elems.length; i++){
var attr = elems[i].getAttribute('data-rowid');
elems[i].addEventListener('click',function(){
console.log(attr);
});
}
When I click on any of the buttons, only the value of data-rowid
attribute of the last element (delButton) is being output on the console. How do I print the data-rowid
value associated with each of the buttons?