Search Results

Search found 1 results on 1 pages for 'nicmare'.

Page 1/1 | 1 

  • if statement to check available elements

    - by nicmare
    Hi there, 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: <li> <span class="panel"> <a href="…" class="image" rel="group"> <img title="…" src="…" alt="…" width="128" height="96" /> </a> <span class="sizes"> <span class="button"> <a href="#" class="size1" rel="…" title="1">9x13</a> </span> <span class="button"> <a href="#" class="size2" rel="…" title="3">10x15</a> </span> <span class="button"> <a href="#" class="size3" rel="…" title="6">20x30</a> </span> </span> </span> <a href="…" class="image" rel="group"> <span class="added"></span> <img title="…" src="…" alt="…" width="128" height="96" class="thumbnail" /> </a> </li> i add two "span" elements through jquery: $('.sizes a').click( function (e) { e.preventDefault(); $(this).after("<span class='checked'></span><span class='remove'></span>"); } ); the maximum amount of those s are 3 times in a wrapped div. so i am trying to do is the following: $(".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(); } } ); 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 how do i achieve this? there is an online demonstration of this: http://bit.ly/972be4 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 Thank you very much! best wishes from germany

    Read the article

1