I have set up an "if" statement in JavaScript that is to check whether or not a checkbox is checked. However, it does not seem to be working. It refers to a checkbox within a form, and the ID for the checkbox is "t1." Please let me know if there is anything apparent that would make it not function properly! It is to be executed when a button on the page is clicked, which should work properly without the "if" statement around it.
The code is below:
var t1v = document.getElementById("t1")
if (t1v.checked) {
document.getElementById("l1q1").style.display = "inline";
document.getElementById("1q1-1").style.display = "inline";
document.getElementById("l1q1-1").style.display = "inline";
document.getElementById("1q1-2").style.display = "inline";
document.getElementById("l1q1-2").style.display = "inline";
document.getElementById("1q1-3").style.display = "inline";
document.getElementById("l1q1-3").style.display = "inline";
document.getElementById("1q1-4").style.display = "inline";
document.getElementById("l1q1-4").style.display = "inline";
}
Aucun commentaire:
Enregistrer un commentaire