0

I would like that when one element is visible, another is not seen.

In my case I would like that when you see the pop up, the red arrow is hidden. I tried to insert this js, but I don't understand where I am wrong:

function pop() {
   if (document.getElementsByClassName("spu-bg").style.display == "block") {
   document.getElementsByClassName("opn").style.display = "none";
   }
}

can you help me?

enter image description here

Miner
  • 41
  • 5
  • use `document.getElementsByClassName("spu-bg")[0].style.display` – Sakil Sep 01 '22 at 09:39
  • `document.getElementsByClassName("spu-bg")` returns an array – Trafalino Sep 01 '22 at 09:39
  • Duplicate: [What do querySelectorAll and getElementsBy\* methods return?](https://stackoverflow.com/questions/10693845/what-do-queryselectorall-and-getelementsby-methods-return) –  Sep 01 '22 at 09:46

0 Answers0