title: How to change button text on click using JavaScript?
body: <p>Only started JS a couple of days ago, and I'm already having some troubles getting a toggle to work. I want the button to toggle between <code>on</code> and <code>off</code> when clicked. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function click() {
    var change = document.getElementById("toggle");
    if (change.innerHTML == "on"); {
      change.innerHTML = "off";
    } else {
      change.innerHTML = "on";
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button type="button" id="toggle" onClick="click()"&gt;on&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is this how I should go about it?</p>