Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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