title: how to remove a class with the onclick event with javascript
body: <p>any way that when I press a button it shows me a class and when I press another it removes the other class from the first button and so on with the other buttons?</p>
  <p>Thank you for your help</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>function myFunction() {
  
    document.getElementById("active1").classList.add('MyClass');
  }
  function myFunction2() {
  
     document.getElementById("active").classList.add('MyClass');
  }
  function myFunction3() {
  
     document.getElementById("active2").classList.add('MyClass');
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.MyClass {
      background-color: red;
      color: #00ff1f;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;body&gt;
  &lt;div id="active1" class="none"&gt;&lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;&lt;/div&gt;
  
  &lt;div id="active" class="none"&gt;&lt;button onclick="myFunction2()"&gt;forobeta&lt;/button&gt;&lt;/div&gt;
  &lt;div id="active2" class="none"&gt;&lt;button onclick="myFunction3()"&gt;femax&lt;/button&gt;&lt;/div&gt;
  &lt;button   onclick="myFunction4()"&gt;forobeta&lt;/button&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>