[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread MorningZ
I'm sure if you dig into the jQuery library that ":even" and ":odd" are doing something along the lines of "nth-child" well, not *too* sure, but it makes some sense at least On Jan 12, 6:41 pm, rolfsf wrote: > that's too easy - it can't be right ;-) > > I guess my mistake was trying to use th

[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread rolfsf
that's too easy - it can't be right ;-) I guess my mistake was trying to use the nth-child(even)? On Jan 12, 12:36 pm, Karl Swedberg wrote: > Simpler still would be this: > > $(this).find("tbody tr:visible:even").addClass("alt"); > > --Karl

[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread MorningZ
ps.. i totally missed the ":visible" selector on the docs On Jan 12, 3:36 pm, Karl Swedberg wrote: > Simpler still would be this: > > $(this).find("tbody tr:visible:even").addClass("alt"); > > --Karl > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Jan 12, 2

[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread Karl Swedberg
Simpler still would be this: $(this).find("tbody tr:visible:even").addClass("alt"); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 12, 2009, at 2:52 PM, brian wrote: Right - that's way simpler. Yay, jQuery! On Mon, Jan 12, 2009 at 2:46 PM, MorningZ

[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread brian
Right - that's way simpler. Yay, jQuery! On Mon, Jan 12, 2009 at 2:46 PM, MorningZ wrote: > > Should work: > > $(this).find("tbody tr").not(":hidden").filter(":even").addClass > ("alt"); > > > On Jan 12, 1:08 pm, brian wrote: >> The way I sometimes do this with PHP is to set a $counter var and

[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread MorningZ
Should work: $(this).find("tbody tr").not(":hidden").filter(":even").addClass ("alt"); On Jan 12, 1:08 pm, brian wrote: > The way I sometimes do this with PHP is to set a $counter var and then > use the modulo operator on the incremented counter to write the > classname for the row. So, someth

[jQuery] Re: table striping - skip hidden rows

2009-01-12 Thread brian
The way I sometimes do this with PHP is to set a $counter var and then use the modulo operator on the incremented counter to write the classname for the row. So, something like this might work: // where you have CSS classes Row0 & Row1 $(this).find("tbody tr:visible").each(function(i, el) {