if statement to check available elements
<p>i allways found an answer here just be reading the threads but now its time for my very first thread because i was unable to find related questions:
this is my target code:</p>

<pre><code>&lt;li&gt;
                &lt;span class="panel"&gt;
                    &lt;a href="…" class="image" rel="group"&gt;
                        &lt;img title="…" src="…" alt="…" width="128" height="96" /&gt;
                    &lt;/a&gt;
                    &lt;span class="sizes"&gt;
                        &lt;span class="button"&gt;
                            &lt;a href="#" class="size1" rel="…" title="1"&gt;9x13&lt;/a&gt;
                        &lt;/span&gt;
                        &lt;span class="button"&gt;
                            &lt;a href="#" class="size2" rel="…" title="3"&gt;10x15&lt;/a&gt;
                        &lt;/span&gt;
                        &lt;span class="button"&gt;
                            &lt;a href="#" class="size3" rel="…" title="6"&gt;20x30&lt;/a&gt;
                        &lt;/span&gt;
                    &lt;/span&gt;
                &lt;/span&gt;
                &lt;a href="…" class="image" rel="group"&gt;
                    &lt;span class="added"&gt;&lt;/span&gt;
                    &lt;img title="…" src="…" alt="…" width="128" height="96" class="thumbnail" /&gt;
                &lt;/a&gt;
&lt;/li&gt;
</code></pre>

<p>i add two "span" elements through jquery:</p>

<pre><code>$('.sizes a').click( 
        function (e) {
            e.preventDefault();
            $(this).after("&lt;span class='checked'&gt;&lt;/span&gt;&lt;span class='remove'&gt;&lt;/span&gt;"); 
        }
);
</code></pre>

<p>the maximum amount of those s are 3 times in a wrapped div. so i am trying to do is the following:</p>

<pre><code>$(".remove").live('click', function(){
            $(this).hide();
            $(this).prev().hide(); // hide checked span
             if ($(this).parent().parent().children().children().each().hasClass('checked'))
             { 
                $(this).parent().parent().parent().next().children(".added").hide();
             } 
        }
    );
</code></pre>

<p>of course my if statement is crap. i try it in my own words:
if there are more than one span(class=remove) in span(class=panel) then 
nothing should happen. 
but if there is just one span(class=remove) left in span(class=panel) THEN 
 should be hidden</p>

<p>how do i achieve this? there is an online demonstration of this: <a href="http://bit.ly/972be4" rel="nofollow">http://bit.ly/972be4</a> as you can see, every time when i hit a button below an image, the image gets marked by a label. and i want to hide this label (class=added) when no button is selected</p>

<p>Thank you very much!
best wishes from germany</p>
