OK - I understand better now what you want to do.
You can use the :eq selector to select an element by index.
With 3 <li> elements per <ul> they have index of 0,1 and 2.
So index 1 is item 2
You can select the second <li> within each <ul> by specifying "ul" as
the context for the selection.
This should do what you want:
                        $("li.selected").fadeOut("slow");
                        $("li").removeClass("selected");
                        $("li:eq(1)", "ul").addClass("selected");
                        $("li.selected").fadeIn("slow");

But, you will find that the fade in starts before the fade out has
finished. If you want them to be sequential then
the fade in should be as part of the callback function of the fade out
                $("li.selected").fadeOut("slow", function () {
                        $("li").removeClass("selected");
                        $("li:eq(1)", "ul").addClass("selected");
                        $("li.selected").fadeIn("slow");
                });

Paul

On Oct 9, 2:22 pm, Vic <[EMAIL PROTECTED]> wrote:
> Thank you
>
> but some problem exists
>
> List like this:
>
> <ul class="class1">
> <li class="selected">Item 1</li>
> <li>Item 2</li>
> <li>Item 3</li>
>
> I need add class "selected" only to one list inem ( first, second,
> third, and so ). After your help I shall have:
>
> <li>Item 1</li>
> <li class="selected">Item 2</li>
> <li class="selected">Item 3</li>
>
> Does exists some function in jQuery which get only "i" element from
> list items?
> $('ul')                   -> for each list
>   .children('li')[X]      -> here I need only elemnt with index
> "i" ( [X] need to be replaced to some construction. which? )
>     .addClass("selected") -> this is I can write

Reply via email to