I wanted to trigger an if condition based on a checked or unchecked checkbox, by clicking a button. The code segments of interest are:
Out-Projekt: <input type= "checkbox" id= "OUT"> <br> <br>
<button class = "buttonz" onclick = "berechnung()">Berechnen </button>
<script>
function berechnung() {
var OUT = parseInt(document.getElementById("OUT").checked);
if( checkbox.checked == true){ code}
else { code }
}
</script>
For some reason, it does not work. I read other topics regarding this but found nothing suitable. Hope someone can help
Aucun commentaire:
Enregistrer un commentaire