Last active
January 31, 2021 17:24
-
-
Save omar2205/53b71e67031b9dfadb7470afe3b3f38c to your computer and use it in GitHub Desktop.
add js and js module script from url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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