title: Can scripts be inserted with innerHTML?
body: <p>I tried to load some scripts into a page using <code>innerHTML</code> on a <code>&lt;div&gt;</code>. It appears that the script loads into the DOM, but it is never executed (at least in Firefox and Chrome). Is there a way to have scripts execute when inserting them with <code>innerHTML</code>?</p>
  
  <p>Sample code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;body onload="document.getElementById('loader').innerHTML = '&lt;script&gt;alert(\'hi\')&lt;\/script&gt;'"&gt;
      Shouldn't an alert saying 'hi' appear?
      &lt;div id="loader"&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>