title: Javascript(not jquery) button onclick, function changes class of button calling function
body: <p>I know you can change the class of a button using </p>
  
  <pre><code> document.getElementById("ID1").setAttribute("class", "NewClass");
  </code></pre>
  
  <p>But say i wanted to change the class to <code>active</code> if the button is clicked, is there anyway to do this without assigning an ID to the buttons ?<br>
  I also don't want to change all buttons with this class and am aware you can use get element by class as well.</p>
  
  <p>The buttons are generated by another piece of javascript and look like</p>
  
  <pre><code>    &lt;button class="btn" onclick="myFunction(this.innerHTML)"&gt;A&lt;/button&gt;
      &lt;button class="btn" onclick="myFunction(this.innerHTML)"&gt;B&lt;/button&gt;
      &lt;button class="btn" onclick="myFunction(this.innerHTML)"&gt;C&lt;/button&gt;
      &lt;button class="btn" onclick="myFunction(this.innerHTML)"&gt;D&lt;/button&gt;
      &lt;button class="btn" onclick="myFunction(this.innerHTML)"&gt;F&lt;/button&gt;
      &lt;button class="btn" onclick="myFunction(this.innerHTML)"&gt;G&lt;/button&gt;
  </code></pre>
  
  <p>Any help would be appreciated.<br>
  Also if you need any more information just let me know.</p>