$("*") 所有元素; $(".intro.demo") 所有 class="intro" 且 class="demo" 的元素; $("p:first") 第一个 <p> 元素;:even选择器选取每个带有偶数 index 值的元素(比如 2、4、6)。 $("tr:even") 所有偶数 <tr> 元素; $("tr:odd") 所有奇数 <tr> 元素; $("ul li:gt(3)") 列出 index 大于 3 的元素;:gt 选择器选取 index 值高于指定数的元素。$("ul li:lt(3)") 列出 index 小于 3 的元素;:not(selector) $("input:not(:empty)") 所有不为空的 input 元素; $(":header") 所有标题元素 <h1> - <h6>;:animated 所有动画元素;:contains(text) $(":contains('W3School')") 包含指定字符串的所有元素;:empty $(":empty") 选择器选取空的元素。;$("p:hidden") 所有隐藏的 <p> 元素; $("table:visible") 所有可见的表格;$("th,td,.intro") 所有带有匹配选择的元素;$("[href]") 所有带有 href 属性的元素;$("[href='#']") 所有 href 属性的值等于 "#" 的元素; $("[href$='.jpg']") 所有 href 属性的值包含以 ".jpg" 结尾的元素; $(":input") 所有 <input> 元素;$(":text") 所有 type="text" 的 <input> 元素; $(":password") 所有 type="password" 的 <input> 元素;(radio,checkbox,submit,reset,button,image,file)。 $(":enabled") 所有激活的 input 元素;$(":disabled") 所有禁用的 input 元素; $(":selected") 所有被选取的 input 元素 $(":checked") 所有被选中的 input 元素。匹配含有选择器所匹配的元素的元素:has(selector)。匹配含有子元素或者文本的元素::parent(与empty相反)。复合属性选择器,需要同时满足多个条件时使用。[selector1][selector2][selectorN]。
2016.11.14 jq(参考手册 - 选择器)
最新推荐文章于 2021-02-15 08:42:39 发布