See http://docs.jquery.com/Traversing/slice#startend
- Richard On Tue, Dec 1, 2009 at 11:07 PM, led <l.r....@sapo.pt> wrote: > Thank you Richard. > > But what about to to use the example with only the first 3 '$ > ('div.star-rating.rater-0.auto-submit-star.star-rating-applied.star- > rating-live')' in page. > Is that i need to show the results of the rating. > > if the result is 3 then add the class to only the first 3 stars. > > > On 2 dez, 03:21, "Richard D. Worth" <rdwo...@gmail.com> wrote: > > On Tue, Dec 1, 2009 at 9:53 PM, led <l.r....@sapo.pt> wrote: > > > I'm try to use star rating plugin frm > > >http://fyneworks.com/jquery/star-rating/. > > > > > I need to add class 'star-rating-on' on the divs with class 'star- > > > rating rater-0 auto-submit-star star-rating-applied star-rating- > > > live' . > > > > That's not a class, it's five classes. Spaces in a class attribute value > > separate multiple class names. > > > > > > > > > I can use: > > > > > $("div.star-rating rater-0 auto-submit-star star-rating-applied star- > > > rating-live") > > > > that selector is looking for all elements of type star-rating-live within > an > > element of type star-rating-applied within an element of type > > auto-submit-star within an element of type rater-0 within an element of > type > > div with a class of star-rating. In this case the space acts as a > descendant > > selector. That would only do if your markup looked something like this > > > > <div class="star-rating"> > > <rater-0> > > <auto-submit-star> > > <star-rating-applied> > > <star-rating-live> > > </star-rating-live> > > </star-rating-applied> > > </auto-submit-star> > > </rater-0> > > </div> > > > > and it would match the star-rating-live element, not the div. > > > > > .each(function(){ > > > $(this).addClass('star-rating- > > > on') > > > }); > > > but it isn't working. > > > > If you really only want the divs with all those classes: > > > > > $('div.star-rating').filter('.rater-0').filter('.auto-submit-star').filter('.star-rating-applied').filter('.star-rating-live').addClass('star-rating-on'); > > > > or more succinctly: > > > > > $('div.star-rating.rater-0.auto-submit-star.star-rating-applied.star-rating-live').addClass('star-rating-on'); > > > > - Richard >