title: (JavaScript & HTML) Change opacity of button on click
body: <p>I was creating a button that when clicked, would change the opacity to 0.5.  If clicked again, it would go back to normal.  I can't seem to figure out what I'm doing wrong.</p>
  
  <p>I tried:</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>$(() =&gt; {
    $(document).on("click", ".test", function() {
      document.getElementsByClassName('test').style.opacity = "0.5";
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;button type="button" class="test"&gt;&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>