Replace text inside a div without affecting any HTML tags inside of it
<p>I see that this has been asked many times. But, unfortunately I have not come across a straight forward solution. Most solutions revolve around multiple nodes within the div.</p>

<p>So here's problem. I have the following markup:</p>

<pre><code>&lt;div class="test"&gt;Text1&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
</code></pre>

<p>I need "Text1" to be replaced with "Text2" without affecting the span tag and event handlers attached to the span tag.</p>

<p>Doing something like <code>$('.test')html('Text2&lt;span&gt;&lt;/span&gt;')</code> does replace the text. But, removes the event handlers on the span tag, which is not desired. I am looking for a quick and efficient method for this one.</p>
