title: How to toggle/switch class of a div onclick using only javascript
body: <p>I want a <code>div</code> to switch its class (toggle) onclick and then revert back to original class onclick again</p>
  
  <p>My code is:</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 myfunc() {
      //the code over here
   }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.normal { 
    width:25%;
    height:25%;
    background: #f00;
  }
  
  .active { 
    width:100%;
    height:100%;
    background: #f00;
  }
  
  #div{}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
    &lt;div id="div" onclick="myfunc()"&gt;click here&lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>