Hi all, sorry for what may be a silly question but I’m very new to Javascript and am having an issue that I need help with.
I have a basic HMTL page with a list of 10 checkboxes that I want to be able to generate a text output when they are checked. Some of the checkboxes should say Correct and some Incorrect.
I have used the script below but it only seems to work for the first checkbox in the list and none of the others.
function myFunction() {
var checkBox = document.getElementById("low-visibility");
var text = document.getElementById("text");
if (checkBox.checked == true){
text.style.display = "block";
} else {
text.style.display = "none";
}
}