javascript - replace string with dynamically created element
<p>I'm trying to replace a placeholder with a dynamically created element.</p>

<p><strong>Approach</strong></p>

<pre><code>var myhtml = 'some html and stuff {IMAGE} some more html';
myhtml = myhtml.replace(/{IMAGE}/g, document.createElement('img'));
console.log(myhtml); // some html and stuff [object HTMLImageElement] some more html
</code></pre>

<p>How can I make it so it replaces it with the actual html output?</p>

<p>Thanks in advance!</p>
