[jQuery] Re: Add a class only to the first parent

2008-08-25 Thread Massimiliano Marini
> $("#foo > .menu > li:not(.expanded)").addClass("bar"); Great Olaf, that's was exactly what I've tried to write. Thanks :) -- Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/ "It's easier to invent the future than to predict it." -- Alan Kay

[jQuery] Re: Add a class only to the first parent

2008-08-24 Thread FrenchiINLA
$('.menu:first').addClass("bar"); On Aug 24, 3:24 pm, Massimiliano Marini <[EMAIL PROTECTED]> wrote: > Hi all, > > I need some help, I want to apply a class with 'addClass' at all of > the first and not to the second > > Example: > > >   1 >   2 >   >     >       3 >       4 >   > > > >

[jQuery] Re: Add a class only to the first parent

2008-08-24 Thread Massimiliano Marini
> $('.menu:first').addClass("bar"); Thanks to you and Olaf, the right way was: $(".menu:first > li").addClass("bar"); I know it was so easy, but thanks 1k :) -- Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/ "It's easier to invent the future than to predict it." -- Alan Kay

[jQuery] Re: Add a class only to the first parent

2008-08-24 Thread Olaf Bosch
Massimiliano Marini schrieb: I need some help, I want to apply a class with 'addClass' at all of the first and not to the second ah sorry after reading better ;) $("#foo > .menu > li:not(.expanded)").addClass("bar"); or so $("#foo > .menu > li").addClass("bar"); see what better for you,

[jQuery] Re: Add a class only to the first parent

2008-08-24 Thread Olaf Bosch
Massimiliano Marini schrieb: I need some help, I want to apply a class with 'addClass' at all of the first and not to the second How can I achieve this? Is possible without using the each() function? Any help, suggestions, examples are welcome. $("#foo > .menu").addClass("bar"); you hav