Still not the best solution, but a bit more efficient:

$("li").removeClass("even odd").each(function(i){
  $(this).addClass(i%2 ? 'odd' : 'even')
});

On Jun 5, 8:40 pm, MorningZ <morni...@gmail.com> wrote:
> // delete <li>
> then
>
> $("li").removeClass("even").removeClass("odd")
>       .filter(":odd").addClass("odd")
>       .end()
>       .filter(":even").addClass("even");
>
> On Jun 5, 7:57 pm, "Dave Maharaj :: WidePixels.com"
>
> <d...@widepixels.com> wrote:
> > I have a li layout which have the even odd class applied to them. Each item
> > in the li has a delete link,click deletes the li but i am left with
> > li class even
> > li class even
> > li class odd
> > if i delete an odd one or vice versa
>
> > how can i upon delete re-assign the even odd classes so they remain looking
> > correct?
>
> > thanks
>
> > Dave

Reply via email to