title: Changing background-color with onclick-function
body: <p>I want to change the background color of a class by clicking on a class. The code that I tried doesn't work. Thank you in advance</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;a href="#!" onclick="message()" onclick="message()" class="changeBack"&gt; SEND ME A MESSAGE &lt;/a&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>.changeBack {
      background-color: rgba(0, 0, 0, 0.0);
  }
  </code></pre>
  
  <p>JAVASCRIPT:</p>
  
  <pre><code>function message() {
  
          var background = document.getElementsByClassName("changeBack").style.backgroundColor;
              if (background == "rgba(0, 0, 0, 0.0)") {
                   background = "rgba(0, 0, 0, 0.1)";
          } else {
          background = "rgba(0, 0, 0, 0.0)";
      }
  
  }
  </code></pre>