Tuesday, May 28, 2024
 Popular · Latest · Hot · Upcoming
177
rated 0 times [  184] [ 7]  / answers: 1 / hits: 15342  / 15 Years ago, fri, june 26, 2009, 12:00:00

This may sound like a simple question, but I just cannot seem to find an answer on google, probably because the search term will bring back quite a lot of irrelevance.



I would like a jQuery selector to select all odd table rows, that are not in <thead> and apply a css class to them all.



table.cp-ss-grid tr:odd


The above selector will bring back all odd rows in the table correctly, but will include the thead rows (on ie)



How would I in the selector do an and, i.e. something like:



table.cp-ss-grid tr:odd:not(thead)


the above doesn't work and still brings back the thead rows



Any ideas?


More From » jquery

 Answers
115

Why not do:



$('table.cp-ss-grid > tbody > tr:odd');


To explicitly select the body rows? All browsers will add a tbody for you if you don't have one.


[#99238] Monday, June 22, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
billtreytonb

Total Points: 211
Total Questions: 104
Total Answers: 114

Location: Sudan
Member since Tue, Aug 3, 2021
3 Years ago
;