TD :contains String but not within a span Element
<p>I want to check wether a TD contains a certain string but only if that string is NOT within a SPAN.</p>

<p>Let's say I want to check all TDs for "TREASURE":</p>

<pre><code>&lt;td&gt; TREASURE &lt;span&gt;Water&lt;/span&gt; &lt;/td&gt; -&gt; YES
&lt;td&gt; Water &lt;span&gt;TREASURE&lt;/span&gt; &lt;/td&gt; -&gt; NO
&lt;td&gt; TREASURE &lt;/td&gt; -&gt; YES
&lt;td&gt; &lt;div&gt;TREASURE&lt;/div&gt; &lt;span&gt;Water&lt;/span&gt;  &lt;/td&gt; -&gt; YES
</code></pre>

<p>So far I have tried different things to exclude span elements from the search but I wasn't successful.</p>

<pre><code>$('table tr td:Contains("TREASURE")').not('span').each(function() {
    $(this).addClass('found');
});
</code></pre>

<p>Thanks a lot! :)</p>

<p>EDIT:</p>

<p>Additionally the following case should also work:</p>

<pre><code>&lt;td&gt; TREASURE &lt;span&gt;TREASURE&lt;/span&gt; &lt;/td&gt; -&gt; YES
</code></pre>