I wanted to know what the error is in this code. The button is set, yes, and the console is pointing to this error.
<script type="text/javascript">
window.onload = function() {
var botao = document.getElementsByTagName('button');
function funcaoAuxiliar(j) {
alert('Você clicou o botão ' + j);
};
};
for (var i=0; i<botao.length; i++) {
botao[i].onclick = funcaoAuxiliar(i);
}
</script>
<button type="button">botao0</button>
<button type="button">botao1</button>
<button type="button">botao2</button>
<button type="button">botao3</button>
<button type="button">botao4</button>
<button type="button">botao5</button>