Insert an image inside an element through its class (HTML + JavaScript)

Example: CodePen Code: <div class=”myClass”></div> <script> document.addEventListener(‘DOMContentLoaded’, function() { document.getElementsByClassName(“myClass”)[0].innerHTML = “<img alt=’my image’ src=’http://astralmemories.com/img/astral-memories-logo.png’>”; }, false); </script>

Continue Reading →