<table>
<tr>
<td><input type='buton' onclick=changeType(this)></td>
<td><input type='buton'></td>
</tr>
<tr>
...
</tr>
</table>
document.querySelector('table').addEventListener('click', ({ target: t }) => {
const next = t.matches('input[type="button"]') && t.parentNode.nextElementSibling;
const input = next && next.querySelector('input');
input && (input.type = 'text');
});