Skip to content

Instantly share code, notes, and snippets.

@ZacharyCouchman
Last active November 18, 2023 02:17
Show Gist options
  • Save ZacharyCouchman/6da12b81c8b0f5382bbb39e61809802e to your computer and use it in GitHub Desktop.
Save ZacharyCouchman/6da12b81c8b0f5382bbb39e61809802e to your computer and use it in GitHub Desktop.
Dynamically load a script into the dom
function loadScript() {
// create a script element
let ourScript = document.createElement('script');
// add the src, where we are loading the script from
ourScript.src = "https://cdn.jsdelivr.net/...";
// append the script to the doucment head (load the script into the DOM)
document.head.appendChild(ourScript);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment