Test if element exists jquery
<p>I'm trying to see if  exists in any of these uls. I tested it with .length but I'm not sure if I'm doing this right. It alerts yes even if there are is no li with the select-sub-domain class. </p>

<p><a href="http://jsfiddle.net/ST8Be/" rel="nofollow">http://jsfiddle.net/ST8Be/</a></p>

<pre><code>if ($('ul.expul &gt; li.select-sub-domain').length &lt; 0) {
var sub_doma = "Not set";
alert("no");
} else {
alert("yes");
var sub_domain = $('li.select-sub-domain').attr('id');
var sub_domainSplit = sub_domain.split('-');
var sub_doma = sub_domainSplit[1];
}​

&lt;ul class="one expul"&gt;
&lt;li class='select' id=eng-88&gt;1&lt;/li&gt;
&lt;li class='select' id=eng-89&gt;2&lt;/li&gt;
&lt;li class='select' id=eng-90&gt;3&lt;/li&gt;
&lt;li class='select' id=eng-91&gt;4&lt;/li&gt;
&lt;li class='select' id=eng-92&gt;5&lt;/li&gt;
&lt;li class='select' id=eng-93&gt;6&lt;/li&gt;
&lt;li class='select' id=eng-94&gt;7&lt;/li&gt;
&lt;li class='select' id=eng-95&gt;8&lt;/li&gt;
&lt;li class='select' id=eng-96&gt;9&lt;/li&gt;
&lt;li class='select' id=eng-97&gt;10&lt;/li&gt;
&lt;li class='select' id=eng-98&gt;11&lt;/li&gt;
&lt;li class='select' id=eng-99&gt;12&lt;/li&gt;                    
&lt;/ul&gt;

&lt;ul class="two expul hide"&gt;
 &lt;li class='select' id=fin-100&gt;1&lt;/li&gt;
&lt;li class='select' id=fin-101&gt;2&lt;/li&gt;
&lt;li class='select' id=fin-102&gt;3&lt;/li&gt;
&lt;li class='select' id=fin-103&gt;4&lt;/li&gt;
&lt;li class='select' id=fin-104&gt;5&lt;/li&gt;
&lt;li class='select' id=fin-105&gt;6&lt;/li&gt;
&lt;li class='select' id=fin-106&gt;7&lt;/li&gt;
&lt;li class='select' id=fin-107&gt;8&lt;/li&gt;                
&lt;/ul&gt;

&lt;ul class="three expul hide"&gt;
 &lt;li class='select' id=three-108&gt;1&lt;/li&gt;
 &lt;li class='select' id=three-109&gt;2&lt;/li&gt;
 &lt;li class='select' id=three-110&gt;3&lt;/li&gt;
 &lt;li class='select' id=three-111&gt;4&lt;/li&gt;
 &lt;li class='select' id=three-112&gt;5&lt;/li&gt;
 &lt;li class='select' id=three-113&gt;6&lt;/li&gt;
&lt;/ul&gt;​
</code></pre>
