Wrap all instances of word in tag?
<p>If I have a <code>div</code> containing words, like so:</p>

<pre><code>&lt;div class="content"&gt;
    In condimentum facilisis porta. Sed nec diam eu diam mattis porta viverra.
&lt;/div&gt;
</code></pre>

<p>How can I find every instance of a word, say <code>porta</code>, and wrap it with a tag, so that it becomes:</p>

<pre><code>&lt;div class="content"&gt;
    In condimentum facilisis &lt;span class="highlight"&gt;porta&lt;/span&gt;. Sed nec diam eu diam mattis &lt;span class="highlight"&gt;porta&lt;/span&gt; viverra.
&lt;/div&gt;
</code></pre>

<p>I've looked at various examples, and I think this is along the right lines:</p>

<pre><code>var elem = $(".content");
elem.text(elem.text().replace("porta", "######"));
</code></pre>

<p>But that fails every now and then, and doesn't replace every instance. I also want to stay away from using <code>REGEX</code>, as it's way too cumbersome and shouldn't be used.</p>
