基本滤镜选择器
:first 匹配第一个元素
:last 匹配最后一个元素
:enen 从匹配的元素中去序数为偶数的元素
:odd 从匹配的元素中去序数为奇数的元素?
:eq(index) 从匹配的元素取第index个元素
:gt(index) 从匹配的元素中取序数大于index的元素
:lt(index) 从匹配的元素中取序数小于index的元素
:empty 匹配没有子元素(包括文本内容)的元素
:parent 匹配包含子元素(包含文本内容)的元素
:hidden 匹配所有隐藏的元素,包含属性type值为hidden的元素
:visible 匹配所有非隐藏的元素
:header 匹配所有标题元素
:contains(text) 匹配所有含有Text的元素
:animated 匹配正在执行动画的元素
:not(selector) 匹配不能满足selector的元素
:has(selector) 匹配包含满足selector的元素
表单滤镜选择器
:input 匹配所有的input,textarea,select,button
:text 匹配文本域
:password 匹配密码域
:redio 匹配单选按钮
:checkbox 匹配复选框
:submit 匹配提交按钮
:image 匹配图像域
:reset 匹配重置按钮
:file 匹配文件域
:enabled 匹配所有可用的元素
:disabled 匹配所有禁用的元素
:checked 匹配所哟选中的元素
:selected 匹配所有选择的元素
属性滤镜选择器
[attribute] 匹配拥有attribute属性的元素
[attribute=value] 匹配属性attribute值为value的元素
[attribute!=value] 匹配属性attribute值不为value的元素
[attribute^=value] 匹配属性attribute的值以value开头的元素
[attribute$=value] 匹配属性attribute的值以value结束的元素
[attribute*=value] 匹配属性attribute的值包含value的元素
示例
<input type="text" name="a">
$("input[name=a]").addClass("s");