Answers for "add script in head tag using javascript file"

0

javascript add script in head programmatically

var my_awesome_script = document.createElement('script');

my_awesome_script.setAttribute('src','http://example.com/site.js');

document.head.appendChild(my_awesome_script);
Posted by: Guest on March-03-2021
10

how to add script in html head

<script src="script.js" defer></script>

<!--just add defer attribute so script will execute at last-->
Posted by: Guest on August-21-2020

Code answers related to "add script in head tag using javascript file"

Browse Popular Code Answers by Language