title: Select current element from getElementsbyClassName
body: <p>This code will hide the first div, even if it were activated from the second button. What keyword should I use to get it to hide the parent div (first button hides the first div, second button hides the second div)?</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-js lang-js prettyprint-override"><code>var x = document.getElementsbyClassName(myClass);
  
  function myFunction() {
    x[0].display = "none";
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="myClass"&gt;
    &lt;button onclick="myFunction()"&gt;Click&lt;/button&gt;
  &lt;/div&gt;
  &lt;div class="myClass"&gt;
    &lt;button onclick="myFunction()"&gt;Click&lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>