function switchVisibility(id){
if(document.getElementById(id).style.visibility === "visible"){
document.getElementById(id).style.visibility = "hidden";
} else {
document.getElementById(id).style.visibility = "visible";
}
}
I'm trying to create a Javascript function that checks whether a CSS attribute is true or false. Based on the state of the attribute it will be changed. But it doesn't work and I'm not finding my mistake.
console.log
s in your code in the logic? Does that reveal any issues?.style.display === "block"