hello everyone I am trying to create 50 buttons all with unique id. I want it so that whenever the user clicks on the button it will send the name of the button (the name is also the button id) of the tech company. So I know which button was press. The code below is what I have tried so far. Much help would be appreciated.
var tech= ["apple","microsoft","google","netflix","sony"];
for (var i = 0; i < tech.length; i++) {
console.log(tech[i]);
document.write('<button class = "tech" value = ' +tech[i]+' id =' +tech[i] + ' onclick = "test('+tech[i]+')"> '+tech[i]+'</h1>');
}
function techid(name){
a = document.getElementById(word);
console.log(a.id);
}