Im making a button 2d matrix in the format:
<table id="board">
<tr class="row 0">
<td class="col 0"><button></button><td>
<td class="col 1"><button></button><td>
<td class="col 2"><button></button><td>
</tr>
<tr class="row 1">
<td class="col 0"><button></button><td>
<td class="col 1"><button></button><td>
<td class="col 2"><button></button><td>
</tr>
<tr class="row 2">
<td class="col 0"><button></button><td>
<td class="col 1"><button></button><td>
<td class="col 2"><button></button><td>
</table>
I wanted to make one function when a user clicks on the buttons. My idea was to get the row and the column from the button that is pressed but Im not sure how to do that. In my js script I wanted to do something like:
document.querySelector('button').onclick = move("insert button row", "insert button column");
I would like any ideas on how to find the parent div or something capable of accomplishing this task.