Skip to main content
  • Create new account
  • Reset your password
张文涛的个人博客
致力于提供Drupal开发,实践等方面的精品资讯

Main navigation

  • 首页
  • 关于
  • Glossary
  • 分享

Breadcrumb

  • Home
  • jQuery 选择器
By admin | 1:14 AM CST, Fri September 16, 2011

jQuery 选择器

选择器 实例 选取
* $("*") 所有元素
#id $("#lastname") id="lastname" 的元素
.class $(".intro") 所有 的元素
element $("p") 所有 <p> 元素
.class.class $(".intro.demo") 所有 且 的元素
:first $("p:first") 第一个 <p> 元素
:last $("p:last") 最后一个 <p> 元素
:even $("tr:even") 所有偶数 <tr> 元素
:odd $("tr:odd") 所有奇数 <tr> 元素
:eq(index) $("ul li:eq(3)") 列表中的第四个元素(index 从 0 开始)
:gt(no) $("ul li:gt(3)") 列出 index 大于 3 的元素
:lt(no) $("ul li:lt(3)") 列出 index 小于 3 的元素
:not(selector) $("input:not(:empty)") 所有不为空的 input 元素
:header $(":header") 所有标题元素 <h1> - <h6>
:animated 所有动画元素
:contains(text) $(":contains('W3School')") 包含指定字符串的所有元素
:empty $(":empty") 无子(元素)节点的所有元素
:hidden $("p:hidden") 所有隐藏的 <p> 元素
:visible $("table:visible") 所有可见的表格
s1,s2,s3 $("th,td,.intro") 所有带有匹配选择的元素
[attribute] $("[href]") 所有带有 href 属性的元素
[attribute=value] $("[href='#']") 所有 href 属性的值等于 "#" 的元素
[attribute!=value] $("[href!='#']") 所有 href 属性的值不等于 "#" 的元素
[attribute$=value] $("[href$='.jpg']") 所有 href 属性的值包含以 ".jpg" 结尾的元素
:input $(":input") 所有 <input> 元素
:text $(":text") 所有 type="text" 的 <input> 元素
:password $(":password") 所有 type="password" 的 <input> 元素
:radio $(":radio") 所有 type="radio" 的 <input> 元素
:checkbox $(":checkbox") 所有 type="checkbox" 的 <input> 元素
:submit $(":submit") 所有 type="submit" 的 <input> 元素
:reset $(":reset") 所有 type="reset" 的 <input> 元素
:button $(":button") 所有 type="button" 的 <input> 元素
:image $(":image") 所有 type="image" 的 <input> 元素
:file $(":file") 所有 type="file" 的 <input> 元素
:enabled $(":enabled") 所有激活的 input 元素
:disabled $(":disabled") 所有禁用的 input 元素
:selected $(":selected") 所有被选取的 input 元素
:checked $(":checked") 所有被选中的 input 元素

Glossary

  • May 2023 (7)
  • March 2023 (1)
  • October 2022 (1)
  • October 2021 (2)
  • August 2021 (4)
  • June 2021 (2)
  • May 2021 (1)
  • April 2021 (2)
  • November 2020 (1)
  • June 2020 (2)
  • December 2019 (2)
  • November 2019 (1)
  • August 2019 (1)
  • February 2018 (1)
  • October 2017 (1)
  • September 2017 (1)
  • July 2017 (1)
  • June 2017 (2)
  • May 2017 (1)
  • March 2017 (3)
  • December 2016 (2)
  • November 2016 (4)
  • October 2016 (3)
  • June 2016 (1)
  • December 2015 (1)
  • November 2015 (6)
  • October 2015 (2)
  • September 2015 (1)
  • August 2015 (1)
  • July 2015 (1)
  • June 2015 (1)
  • May 2015 (1)
  • March 2015 (1)
  • January 2015 (1)
  • December 2014 (3)
  • October 2014 (5)
  • September 2014 (3)
  • August 2014 (1)
  • July 2014 (1)
  • June 2014 (1)
  • May 2014 (1)
  • April 2014 (2)
  • March 2014 (2)
  • February 2014 (2)
  • January 2014 (4)
  • December 2013 (1)
  • March 2013 (2)
  • February 2013 (2)
  • December 2012 (2)
  • November 2012 (4)
  • October 2012 (1)
  • September 2012 (6)
  • August 2012 (15)
  • July 2012 (5)
  • June 2012 (13)
  • May 2012 (9)
  • April 2012 (8)
  • March 2012 (9)
  • February 2012 (3)
  • January 2012 (1)
  • December 2011 (1)
  • November 2011 (6)
  • October 2011 (2)
  • September 2011 (17)
  • August 2011 (4)
  • July 2011 (4)
  • June 2011 (5)
  • May 2011 (4)

Copyright © 2025

苏ICP备14044171号-1