Blogger Information
Blog 25
fans 1
comment 0
visits 25371
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JQuery之选择器--20180121
曲小冷
Original
632 people have browsed it

jQuery之所以好用,主要是其选择器的功能的强大:

元素选择器:$('标签名称')    $('div') 可选择多个元素中间使用逗号分隔开

类选择器:$('.class')    类名前加 .

ID选择器:$('#ID')    ID前加 #

通配符:$('*')    选择所有元素

后代选择器:$(ancestor descendant)  ancestor 下的 descendant 后代元素

子元素选择器:$(parent > child)

后面相邻的兄弟:$(prev + next)

后面所有兄弟:$(prev ~ siblings)

获取第一个元素:$(元素:first)

去除指定元素:$(元素:not(selector))

索引值为偶数元素:$(:even)    奇数:$(:odd)

根据索引选择:$(元素:eq(index))    $("元素:nth-child(index)")

匹配给定属性元素:$(元素[attribute])

...

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post