I'm trying to load a multiple document.write scripts into a single document. Like this:
:DocWrite.js
document.write('<a href="#"><img src='myimage.gif'/></a>');
MyHTML.html
$('.myclass').each( function( index, element ){
var script = unescape('%3Cscript src="'+DocWrite.js+'" type="text/javascript"%3E%3C/script%3E');
$(element).html( script );
});
<div class="myclass">document.write loads image here</div>
<div class="myclass">stops here and hangs</div>
<div class="myclass">same</div>
The first div loads the script and the image is written inside but it stops after that. I would just change DocWrite.js but I don't have access to it. Any ideas how I can fix this? Thanks in advance.
document.body.innerHTML+="content to add"instead ofdocument.write()document.writefunction, but I'm truly not sure if I should be recommending this as I have no idea if it would work or what the downsides are.