Stuck at calling a simple JS function. Developer tools at chrome, console tab, thows
(index):591 Uncaught ReferenceError: checkbox is not defined at myFunction ((index):591) at HTMLInputElement.onclick
Code is
<span>Notificaciones</span>
<input type="checkbox" id="myCheck" onclick="myFunction()">
<script type="text/javascript">
function myFunction() {
var checkBox = document.getElementById("myCheck");
if(checkbox.checked){
alert("suscribe");
} else{
alert("descuscribe");
};
};
</script>
Aucun commentaire:
Enregistrer un commentaire