jQuery----过滤器

jQuery——过滤器

一,过滤器选择器::
:first 例如: $(‘li:first’) ----first()
:last 例如: $(‘li:last’) ----last()
:not(.red) 例如: $(‘li:not(.red)’) ----not()
:even 例如: $(‘li:even’)
:odd 例如: $(‘li:odd’)
:eq(索引值) 例如: $(‘li:eq(0)’) ----eq()
:gt(索引值) 例如: $(‘li:gt(1)’)
:lt(索引值) 例如: $(‘li:lt(1)’)
:header 例如: $(’:header’) 选择h1-h6
:animated 例如: ( ′ : a n i m a t e d ′ ) : f o c u s 例 如 : (':animated') :focus 例如: (:animated):focus(’:focus’) 初始状态需要激活

二,内容过滤器:
:contains(text) 例如: $(‘li:contains(“text”))
:has(.red) 例如: $(‘ul:has(.red)’)
选择子元素含有类的元素
:empty 例如: $(’:empty’)
:parent 例如: $(‘parent’) 含有子元素或文本
parent() ----- 获取【父元素节点】

三,可见性过滤器
:hidden 例如: $(’:hidden’)
:visible 例如: $(’:visible’)
属性:Visibility:hidden; 隐藏元素,占用文档流 也可以使用透明度为:0实现效果
Display:none; 隐藏元素,不占用文档流

四,子元素过滤器
:first-child 例如:$('li:first-child')
:last-child 例如:$('li:last-child')
:only-child 例如:$('li:only-child')
:nth-child() 例如:$('li:nth-child(1)')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值