title: Jquery Script not loading in head when I create dynamically html page using javascript
body: <p>I created dynamically new window in JavaScript and add some HTML code in it through JavaScript, but when I insert some script link into html head, it does not load when window is open.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;    
  function newWindowMap(){
  
      var myWindow = window.open('','_blank');
      var head = myWindow.document.getElementsByTagName('head')[0];
      var body = myWindow.document.getElementsByTagName('body')[0];
  
      var jqueryScript = myWindow.document.createElement('script');
      jqueryScript.src = 'jquery.min.js';
      jqueryScript.type = "text/javascript";
      head.appendChild(jqueryScript);
  
      var alertScr = myWindow.document.createElement('script');
      var inlineScript = 
   document.createTextNode('$(document).ready(function(){alert("Hello World!");});');
      alertScr.appendChild(inlineScript);
      body.appendChild(alertScr);
  
  }
   &lt;/script&gt;
  </code></pre>
  
  <p>Error on console:</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: $ is not defined
        at :1:1</p>
  </blockquote>