分类:jQuery 扩展


jQuery has extended the CSS3 selectors with the following selectors. Because these selectors are jQuery extension and not part of the CSS specification, queries using them cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. To achieve the best performance when using these selectors, first select some elements using a pure CSS selector, then use .filter().

:eq() Selector

在匹配的集合中选择索引值为index的元素。

:even Selector

选择所引值为偶数的元素,从 0 开始计数。 也可以查看 odd.

:gt() Selector

选择匹配集合中所有大于给定index(索引值)的元素。

:has() Selector

选择元素其中至少包含指定选择器匹配的一个种元素。

:lt() Selector

选择匹配集合中所有索引值小于给定index参数的元素。

:odd Selector

选择索引值为奇数元素,从 0 开始计数。同样查看偶数 even.