jQuery----选择器

jQuery选择器

  • 强大的选择器

    因为jquerydom元素获取 使用的css1-css3的选择器 来匹配元素

基本选择器:
#id
element
.class
selector1,selector2,selectorN
  • 层级选择器
  ancestor descendant
  parent > child
  prev + next
  prev ~ siblings
  • 筛选器
:first
  :not(selector)
  :even
  :odd
  :eq(index)
  :gt(index)
  :last
  :lt(index)
  :header
  :animated
  :focus
  • 内容选择器
  :contains(text)
  :empty
  :has(selector)
  :parent
  • 可见性选择器
  :hidden
  :visible
  • 子元素选择器
  :first-child
  :first-of-type1.9+
  :last-child
  :last-of-type1.9+
  :nth-child
  :nth-last-child()1.9+
  :nth-last-of-type()1.9+
  :nth-of-type()1.9+
  :only-child
  :only-of-type1.9+
  • 表单选择器
  :input  匹配所有 input, textarea, select 和 button 元素
  :text
  :password
  :radio
  :checkbox
  :submit
  :image
  :reset
  :button
  :file

猜你喜欢

转载自blog.csdn.net/weixin_47863547/article/details/113575013
今日推荐