(
.
o
n
e
+
d
i
v
)
选
取
c
l
a
s
s
为
o
n
e
的
下
一
个
d
i
v
元
素
;
(
(.one + div)选取class为one的下一个div元素;(
(.one+div)选取class为one的下一个div元素;(("#one~div")选取id为two的元素后面的所有div兄弟元素)
可以用next()方法来代替$(".one+div")
$(".one+div") <==> $(".one").next(“div”);
可用nextAll()代替$("#one~div")
$("#one~div") <==> $("#one").nextAll(“div”);
属性选择器
代码
描述
[attribute] h1[title]
选中具有title这个属性的h1标签
[attribute=value] h1[title=world]
选中title属性值为world的标签
[attribute!=value] h1[title!=world]
选中title属性值不为world的标签
[attribute^=value] h1[title^=hello]
选中title属性值以hello开头的
[attribute
=
v
a
l
u
e
]
h
1
[
t
i
t
l
e
=value] h1[title
=value]h1[title=hello]