I have this line that is inside a foreach:
<input type="checkbox" id="idAprovacao" name="idAprovacao"
onclick="atualizaSituacao(<?php echo $resulta->id_aprovacao;?>);"
<?php echo ($resulta->in_situacao == "4") ? "checked disabled" : "" ?> value="">
And I have this function that causes the question to exist and if it is accepted it does something and should NOT clear the checkbox, however this only happens for the first record displayed.
function atualizaSituacao(id)
{
confirma = window.confirm('Esse registro realmente foi lançado no SIGRH?');
var idAprovacao = id;
if(confirma == true) {
// acontece algo
} else {
document.getElementById('idAprovacao').checked = false;
}
}
What's wrong or missing?