Skip to content

Instantly share code, notes, and snippets.

@JeppeSigaard
Created June 26, 2024 14:18
Show Gist options
  • Save JeppeSigaard/92760c7696011fda9bda42d86c0f8f69 to your computer and use it in GitHub Desktop.
Save JeppeSigaard/92760c7696011fda9bda42d86c0f8f69 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Script button</title>
</head>
<body>
<button id="button">Button</button>
<script>
const elem = document.getElementById("button");
elem.addEventListener("click", () => {
const tag = document.createElement("script");
tag.src = "./script.js";
document.getElementsByTagName("body")[0].appendChild(tag);
});
</script>
</body>
</html>
alert("Implicit load execution");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment