this should do it:

$('tr .myToggle:visible:odd').addClass('gray');

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Nov 2, 2009, at 4:31 PM, Manimal wrote:

Here's what I'm trying to do. When I click on a tr i'd like it to hide
then re-style the table to alternate gray rows.

So on click I hide the tr then run this at the end of the animation/
hide

$('tr .myToggle').removeClass('gray');
$('tr .myToggle').not(':hidden').not(':even').addClass('gray');

I want to know if there is a better way of writing the second line:
$('tr .myToggle').not(':hidden').not(':even').addClass('gray');

I've tried:
$('tr .myToggle:not(':hidden'):odd').addClass('gray');//does not work

And some other variations on that. If i leave off the :not(':hidden')
i'll get all rows whether hidden or not, which means coloring odd or
even rows will not work, it won't look stripped.

Anyway does anyone know how to do this in the selector? Or could you
point me to some documentation on how to write selectors?

Thanks!

Reply via email to