0

does anyone know of a simple script to have a list of items and show/hide one <li> at a time without engaging ALL of them in the list? Just seeing if anyone had something clever.

enter image description here

I want to find the parent of each link in a list so it only slideToggle's the appropriate <li> as you go down. I'm trying to list classes for a school and you can open them and see more as you go along, but not open ALL of them at once, and without writing 200 click statements ;)

$('.link').click(function() {
  $('.li').slideToggle();
});


$(this).parent().parent().next('.toggle').toggle('slow')
or

$(this).closest('tr').next('.toggle').toggle('slow');
Jeff Voss
  • 3,637
  • 8
  • 46
  • 71
  • What do you mean by engaging? – PeeHaa Jul 04 '11 at 18:31
  • You really need to do a better job of explaining what you want. Your graphic isn't very helpful. Are you saying there's a different button associated with each `
  • ` that should only affect that `
  • `? Are you saying that there's a button that should affect several `
  • ` elements filtered by some criteria, and show/hide them in some sort of consecutive animation? This question sounds very similar to [your previous question](http://stackoverflow.com/questions/6566861/jquery-show-one-element-at-a-time). Why not just take the time to thoroughly describe what you're after?
  • – user113716 Jul 04 '11 at 18:37
  • yea I suppose I just need to figure this out on my own – Jeff Voss Jul 04 '11 at 18:39
  • 1
    @WHITEBOX: That's up to you, but you'll get plenty of help if you just describe in detail what it is that you want. Including some HTML and JavaScript helps enormously as well. If you say something like, *"I have a group of `
  • ` elements, each of which has a button inside of it that should show/hide that particular `
  • `*" and then provide some HTML to further clarify the relationship, it would make a world if difference.
  • – user113716 Jul 04 '11 at 18:50
  • ... How is your HTML structured? Also, you have an element with a class named `li`? – kei Jul 04 '11 at 18:58