JSFiddle - React, Tailwind, and code Playground
by Alexis López Espinoza
HTML
<table>
<tr>
<th>id</th>
<th>Nombre</th>
<th>boton</th>
</tr>
<tr>
<td>1</td>
<td>Carlos</td>
<td><input type="button" value = "clic" /></td>
</tr>
<tr>
<td>2</td>
<td>José</td>
<td><input type="button" value = "clic" /></td>
</tr>
<tr>
<td>3</td>
<td>María</td>
<td><input type="button" value = "clic" /></td>
</tr>
</table>
JavaScript
Array.prototype.forEach.call(document.getElementsByTagName("input"), function(input){
if (input.type == "button"){
input.addEventListener("click", function(){
alert(this.parentNode.parentNode.children[0].innerHTML);
});
}
});