How to get the first text node from a string?
<p>Trying to get the very first text node.</p>

<pre><code>var s = $.trim('login&lt;tbody&gt; &lt;tr&gt; &lt;td class="translated"&gt;Lorem ipsum dummy text&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="translated"&gt;This is a new paragraph&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="translated"&gt;&lt;b&gt;Email&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;i&gt;This is yet another text&lt;/i&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;');

if($(s).find('*').andSelf().not('b,i').length &gt; 1){
    alert($(s).find('*:not(:empty)').first().text());
}
</code></pre>

<p><a href="http://jsfiddle.net/GNp84/" rel="nofollow">Here is a link to what i am doing on jsfiddle</a></p>

<p>It is not giving me the very first text node which is <strong>"login"</strong> rather it is givig me
<strong>"lorem ipsum..."</strong> which is 2nd text node.</p>

<p><strong>NOTE:</strong> </p>

<p>The HTML string is dynamic so do not think of assigning class or id to it or enclosing it in some HTML element or substring etc.</p>
