jquery check this has content
<p>How to check this has content in a jquery test? I want to check if each li is not empty, do some stuff.</p>

<p><a href="http://jsfiddle.net/h8UXV/" rel="nofollow">Online demo</a> And code repeart:</p>

<p>HTML</p>

<pre><code>&lt;ul&gt;
 &lt;li&gt;list1&lt;/li&gt;
 &lt;li&gt;&lt;/li&gt;
 &lt;li&gt;list3&lt;/il&gt; 
 &lt;li&gt;list4&lt;/li&gt;
 &lt;li&gt;&lt;/li&gt; 
&lt;/ul&gt;
&lt;div&gt; &lt;/div&gt;
</code></pre>

<p>javascript</p>

<pre><code>$('ul li').click(function(){
   var list = $(this).html();
   if($(this':has(*)').length){
         $('div').html( list );
   }
});
</code></pre>

<p>CSS </p>

<pre><code>ul{
    list-style:none;
    width:210px;
}
li{
    float:left;
    background:#ccc;
    width:200px;
    height:30px;
    margin:3px;
    display:block;
}
div{
    float:left;
    display:inline-block;
    line-height:30px;
    background:#ff0ff0;
    width:200px;
}
</code></pre>
