jQuery选择器AND运算符 [英] jQuery selector AND operator
问题描述
这可能听起来像一个简单的问题,但我似乎找不到在谷歌的答案,可能是因为搜索字词将带来很多不相关。
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.
我想要一个jQuery选择器来选择所有奇数表行,不在< thead>并对它们应用一个css类。
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
上述选择器将正确地恢复表中的所有奇数行,但将包括thead行(on)
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)
仍会带回thead行
任何想法?
推荐答案
不执行:
$('table.cp-ss-grid > tbody > tr:odd');
要显式选择正文行?如果您没有浏览器,所有浏览器都会为您添加一个tbody。
To explicitly select the body rows? All browsers will add a tbody for you if you don't have one.
这篇关于jQuery选择器AND运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!