Skip to content

Instantly share code, notes, and snippets.

@omar2205
Last active January 31, 2021 17:24
Show Gist options
  • Save omar2205/53b71e67031b9dfadb7470afe3b3f38c to your computer and use it in GitHub Desktop.
Save omar2205/53b71e67031b9dfadb7470afe3b3f38c to your computer and use it in GitHub Desktop.
add js and js module script from url
const addJs = url => {
let jsScript = document.createElement('script')
jsScript.setAttribute('src', url)
document.head.appendChild(jsScript)
}
const addJsModule = url => {
let jsScript = document.createElement('script')
jsScript.setAttribute('src', url)
jsScript.setAttribute('type', 'module')
document.head.appendChild(jsScript)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment