title: Changing the Style of a HTML-Button within a JavaScript Function
body: <p>I am trying to change the style class of a button when clicking it but it is not working how it should.</p>
  
  <p>I need the style/icon change inside a JS function because I am doing some more stuff when the buttons gets clicked.</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 generate() {
  //// Some stuff
    document.getElementById('btn1').class = 'play icon fa fa-stop';
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"&gt; 
  
  &lt;div class='container20'&gt;
    &lt;button class='play icon fa fa-play-circle-o' type='button' onclick='generate()' id="btn1"&gt;Button&lt;/button&gt; 
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>