title: Add class to the clicked button on nodeList in javascript
body: <p>I have list of <code>button</code> elements and I want add a class to each when clicked on and remove the class from all other buttons. How I can do this in pure Javascript?</p>
  
  <pre><code>&lt;button&gt;btn1&lt;/button&gt;
  &lt;button&gt;btn2&lt;/button&gt;
  &lt;button&gt;btn3&lt;/button&gt;
  &lt;button&gt;btn4&lt;/button&gt;
  &lt;button&gt;btn5&lt;/button&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>var el = document.querySelectorAll("button");
  
  el.addEventListener("click", function() {
    el.classList.remove("toggle");
    this.classList.add("toggle");
  });
  </code></pre>