指定元素中包含 id 属性的, 如: $("span[id]")
AAA
BBB
CCC
DDD
指定元素中不包含 id 属性的, 如: $("span:not(span[id])") 或 $("span:not([id])")
AAA
BBB
CCC
DDD
包含 id 属性的, 如: $("body [id]")
AAA
BBB
CCC
DDD
符合元素值的, 如: $("span[name='S2']")
AAA
BBB
CCC
DDD
不符合元素值的, 如: $("span[name!='S2']")
AAA
BBB
CCC
DDD
元素值开头是?, 如: $("span[name^='S']")
AAA
BBB
CCC
DDD
元素值结尾是?, 如: $("html [name$='1']")
AAA
BBB
CCC
DDD
元素值包含?, 如: $("body [name*='x']")
AAA
BBB
CCC
DDD
多个属性条件, 如(有 id 且 name 开始是 "D"): $("body [id][name^='D']")
AAA
BBB
CCC
DDD
查找包含 "AB" 的 span: $("span:contains('AB')")
ABC
ABC
ABC
ABC
从 div 中查找包含 "AB" 的 span: $("div span:contains('AB')")
ABC
ABC
ABC
ABC
查找包含 的 span: $("span:has('b')")
ABC
ABC
ABC
ABC
查找空的 span: $("span:empty")
ABC
ABC
ABC
ABC
查找非空的(也就是作为父元素的) span: $("span:parent")
ABC
ABC
ABC
ABC
:hidden 与 :visible 分别对应隐藏与显示的元素; 下例让已显示的变红, 让隐藏的显示为灰色.
<script src="http://code.<a%20style=" color: text-decoration:underline title="jquery" href="https://www.php.cn/zt/15736.html" target="_blank">jquery.com/jquery-1.4.2.min.js"></script>
<script> <br>$("div:visible").css("color", "red"); <br>$("div:hidden").css("display", "").css("color", "silver"); <br></script>
表单匹配:
:input 匹配:
:text 匹配
:password 匹配
:radio 匹配
:checkbox 匹配
:submit 匹配
:reset 匹配
:image 匹配
:file 匹配
:button 匹配
:enabled 匹配 所有可用的 input 元素
:disabled 匹配 所有不可用的 input 元素
:checked 匹配 所有选中的被选中复选框、单选框
:selected 匹配 所有选中的 option 元素










