Skip to content

Instantly share code, notes, and snippets.

@webuilder240
Created March 11, 2018 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webuilder240/fef4622a085b1c3bf9b39b261bf0b579 to your computer and use it in GitHub Desktop.
Save webuilder240/fef4622a085b1c3bf9b39b261bf0b579 to your computer and use it in GitHub Desktop.
load dynamic execute script tag
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div id="script_test">
</div>
<script src="test1.js"></script>
</body>
</html>
var script = document.createElement('script');
script.src = 'test2.js';
document.getElementById('script_test').appendChild(script);
alert('test');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment