title: Using .replace to replace text with HTML?
body: <p>I want to replace text with an image using jQuery. I have been using the .replace function to replace text with more text. How would I replace the text with an html tag, like an &lt;img&gt; tag.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>function wow() {
    $('.messageBody').each(function() {
        var text = $(this).text();
        var image = '&lt;img class = "emote" src = "trump.png"&gt;'
        $(this).text(text.replace(':trump:', image.outterHTML));
    });
  }
  setInterval(wow, 1000);
  </code></pre>
  
  <p>Here is the HTML:</p>
  
  <pre><code>&lt;span class="messageBody"&gt;:trump:&lt;/span&gt;
  </code></pre>