The selector "ul li" selects _all_ LI elements in all UL elements, and
puts them in the same "collection". So the collection/array will look
like this:

  <li>alpha</li>, <li>beta</li>, <li>gamma</li>, <li>delta</li>

If you want to deal with each UL element separately then use "each()", like so:

  $("ul").each( function() {
    // this == a UL element
    $("li:gt(0)", this).hide();
    // etc
  });

Karl Rudd

On Tue, Jun 17, 2008 at 10:51 PM, Panos <[EMAIL PROTECTED]> wrote:
>
> Using two ul lists:
>
> <ul>
>        <li>alpha</li>
>        <li>beta</li>
> </ul>
>
> <ul>
>        <li>gamma</li>
>        <li>delta</li>
> </ul>
>
> In jQuery, I am trying to select all li's *except* the first one:
>
> $("ul li:gt(0)").hide();
>
> and then on hover, reveal them:
>
> $("ul:first-child").hover(
>                function() {
>                        $("#preferences ul li:gt(0)").show();
>                },
>                function() {
>                        $("#preferences ul li:gt(0)").hide();
>                }
> );
>
>
> The problem is, that the selector "ul li:gt(0)", goes on and hides the
> second list ('gamma', 'delta').
>
> As those are two individual lists, I thought that 'gamma' was
> index[0], and not part of the first list, ie index[2].
>
> Am I wrong? Is there another way to do this?
>

Reply via email to