JSFiddle - React, Tailwind, and code Playground
by fguillen
HTML
<div id="image_collection">
<div class="image" data-src="http://image1.jpg"></div>
<div class="image" data-src="http://image2.jpg"></div>
</div>
CSS
div {
border: 1px solid red;
}
img {
border: 1px solid black;
}
JavaScript
images = function(){
$('.image').each(function( index, element ){
var image = new Image(); //NEW INSTANCE(S) CREATED (IN MEMORY)
image.src = $(this).attr('data-src');
$(this).parent().append(image);
});
}