title: JS, a way to have a button refresh the result and print it on the page
body: <pre><code>&lt;script&gt;
        function makeid() {
          var text = "";
          var char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
          for (var i = 0; i &lt; l; i++) {
            text += char_list.charAt(Math.floor(Math.random() * char_list.length));
          }
          return text;
        }
        console.log(makeid(8));
        makeid(8);
        document.write(makeid());
      &lt;/script&gt;
  </code></pre>
  
  <p>Hey, guys. I have this code currently in my HTML, I'm wondering how I can have the output of this code printed on the page and then refreshed everytime I click an HTML button. If you have any questions I'll try to answer them best I can.</p>