I would give the SCRIPT tag an identifier and replace the SCRIPT tag itself with the contents of DIV +, so it should only include one line of code. Something like the following:
<script id="my-script" src="http://example.com/my-script.js"></script>
In your script, you can change the SCRIPT tag for your DIV in one fell swoop, for example:
var scriptTag, myDiv;
scriptTag = document.getElementById('my-script');
myDiv = document.createElement('DIV');
myDiv.innerHTML = '<p>Wow, cool!</p>';
scriptTag.parentNode.replaceChild(myDiv, scriptTag);
source
share