I'm trying to fetch and change the values of a checkbox using Javascript. The intention is, when the JS function is called, check that the checkbox is set. If not, seven-a as checked, and vice versa. But when trying to read the state of the checkbox the following error is shown: "Can not read property 'checked' of null"
My last attempt so far was as follows:
<label for="letrasMinusculas">
<img src="images/checked.png" id="imgLetrasMinusculas" onclick="changeIcon(letrasMinusculas)">
</label>
<input id="letrasMinusculas" class="boxOculto" name="letrasMinusculas" type="checkbox" checked>
And in Javascript:
function changeIcon(id){
var status = document.getElementById(id);
if (status.checked){
alert("Verdadeiro");
}
else{alert("Falso");}
}