checked 选择器
描述: 匹配所有被选中(checked)或被选定(selected)的元素。
版本添加: 1.0jQuery( ":checked" )
:checked 选择器适用于复选框(checkboxes)、单选按钮(radio buttons)以及 select 元素中的选项(options)。
要仅检索 select 元素中被选定的选项,请使用 :selected 选择器。
示例
示例 1
确定有多少个 input 元素被选中。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
|
演示
示例 2
识别被选中的 radio input。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
|