title: Uncaught TypeError: Cannot set property 'visibility' of undefined
body: <p>I'm trying to make some stuff invisible after I press a button. The thing is I wanna target multiple things at the same time. </p>
  
  <p>So I can't use:
      <code>document.getElementById("targ").style.visibility = "hidden";</code></p>
  
  <p>Because it targets only 1 element out of 4.</p>
  
  <p>I tried using:
      `document.getElementsByClassName("targ").style.visibility = "hidden";</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>        &lt;div id="navbar" class="sticky"&gt;
              &lt;li&gt;&lt;a href="#top" style="padding:0px" id="targimg"&gt;&lt;img src="act_logo.png"&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#description" class="targ"&gt;Description&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#video" class="targ"&gt;Video&lt;/a&gt;&lt;/li&gt;
              &lt;li style="float:right" class="targ"&gt;&lt;a href="#top"&gt;Top&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#explication" class="targ"&gt;Explication&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a&gt;&lt;span style="font-size:20px;cursor:pointer" onclick="openNav()"&gt;&amp;#9776; open&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/div&gt;
  
  &lt;script&gt;
  function openNav() {
                  document.getElementById("mySidenav").style.width = "250px";
                  document.getElementsByClassName("targ").style.visibility = "hidden";
                  document.getElementById("targimg").style.textAlign = "center";
              }
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>`</p>
  
  <p>But this isn't able to change the visibility. I get the error: Uncaught TypeError: Cannot set property 'visibility' of undefined at (then theres my function name here)</p>