<script src = "..."> </script> via .innerHTML add
JavaScript dynamically adds script tag with SRC ATTRIBUTE via innerHTML
For example:
var banner = '<script src="http://example.com/script.js"><\/script>'; document.getElementById("examplediv").innerHTML = banner; I see a script tag in a DIV with id = "examplediv", but script.js is not loading.
The variable banner can contain different data (HTML code), and I cannot use document.createElement ('script') ;, setAttribute, etc.
Without any libraries like jQuery.
How can I load a script file and execute its contents?
PS Excuse me for my English.
No one has answered this question yet.
See similar questions:
or similar: