Answers for "error Cannot set property 'visibility' of undefined"

0

error Cannot set property 'visibility' of undefined

function openNav() {
  // document.getElementById("mySidenav").style.width = "250px";
  targList = document.getElementsByClassName("targ");
  document.getElementsByClassName("targ")
  if (targList) {
    for (var x = 0; x < targList.length; x++) {
      targList[x].style.visibility = "hidden";
    }
  }
  document.getElementById("targimg").style.textAlign = "center";
}
Posted by: Guest on January-18-2021
0

error Cannot set property 'visibility' of undefined

document.getElementsByClassName("targ").forEach(e => e.style.visibility = "hidden");
Posted by: Guest on January-18-2021

Code answers related to "error Cannot set property 'visibility' of undefined"

Browse Popular Code Answers by Language