Special symbols in selection:
# Instruction id
. Instruction class
* Select all
, multi-select
space descendants
> child
~ brother
Next
: Child (multi-function)
() Functional filtering and search
Get all header objects under div: $("div :header")
Get all title objects: $(" :header")
Get first, such as: $("li:first") or $("li").first() or $("ul :first") or $("ul li:first")
- AAA
- BBB
- CCC
- DDD
- EEE
< li>FFF
- GGG
Get the first of each group, such as: $("li:first-child") or $("ul li:first-child") or $("ul : first-child")
- AAA
- BBB
- CCC
- DDD
< li>EEE
- FFF
- GGG
Get last, such as: $("li:last") or $("li").last() Or $("ul :last") or $("ul li:last")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
< /ul>
Get the last of each group, such as: $( "li:last-child") or $("ul li:last-child") or $("ul :last-child")
Copy code The code is as follows:
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取第几个, 如(获取第三个, eq 是 0 起): $("li:eq(2)") 或 $("li").eq(2)
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取第几个之后的, 如(获取第三个之后的, gt 是 0 起): $("li:gt(2)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取第几个之前的, 如(获取第三个之前的, lt 是 0 起): $("li:lt(2)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取索引值是偶数的, 如(even 是 0 起): $("li:even")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取索引值是奇数的, 如(odd 是 0 起): $("li:odd")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取每组第偶数个, 如(nth-child 是 1 起): $("li:nth-child(even)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取每组第奇数个, 如(nth-child 是 1 起): $("li:nth-child(odd)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
获取每组第几个, 譬如第 2 个(nth-child 是 1 起): $("li:nth-child(2)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
用表达式指示每组的第几个, 如(nth-child 是 1 起): $("li:nth-child(3n-1)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
如果是父元素中唯一的子元素, 如: $("li:only-child")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
:not 是对其他选择的取反, 如: $("li:not(li:first-child)")
- AAA
- BBB
- CCC
- DDD
- EEE
- FFF
- GGG
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn