Skip to content

Instantly share code, notes, and snippets.

@dansalias
Created January 14, 2020 15:15
Show Gist options
  • Save dansalias/7d413ef23a66bf76ef44ac7fd95ad0cd to your computer and use it in GitHub Desktop.
Save dansalias/7d413ef23a66bf76ef44ac7fd95ad0cd to your computer and use it in GitHub Desktop.
Create DOM elements with attributes.
const myScript = Object.assign(document.createElement('script'), {
src: '/some-script.js',
type: 'text/javascript',
async: true,
});
document.head.appendChild(myScript);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment