Create <script> and fill in script src in a div - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Create <script> and fill in script src in a div

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/* w  w w .j  a  va 2  s .com*/
var url = "https://code.jquery.com/jquery-1.10.2.js";
var script = document.createElement("SCRIPT");
script.src = url;
document.body.appendChild(script);
console.log("It worked with NO errors!!!!");
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials