1. 1
  1.  

  2. 1

    Can we not start people off with inline javascript? CSP is a thing.

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8" /> 
        <title></title>
        <script>
          function init() {
            var e = document.getElementById('foo');
            var txt;
            if (null !== e) {
              txt = document.createTextNode('hello, world');
              e.appendChild(txt);
            }
          }
          document.addEventListener('DOMContentLoaded', init);
        </script>
      </head>
      <body>
        <span id="foo"></span>
      </body>
    </html> 
    
    
    1. 1

      I like your example. I also see value in what you are saying. I’m actually pretty new to JS myself. Thanks for the tip!