选择器概念:
jQuery选择器是通过标签、属性或者内容对HTML内容进行选择,选择器运行对HTML元素组或者单个元素进行操作。jQuery选择器使用$符号,等同于jquery。
jQuery中的选择器种类有:
1.id选择器
$("#myElement");
2.class选择器
$(".myClass");
3.属性选择器(标签选择器)
$(“p”);
4.通配符选择器
$("*"); 匹配所有元素,返回元素集合
5.层级选择器
ancestor descendant 、parent > child 、prev + next 、prev ~ siblings
6.过滤器选择器
基本过滤器选择器
:first 、:last 、:not 、:even 、:odd 、:eq 、:gt 、:lt 、:header 、
:animated
内容过滤器选择器
:contains 、:empty 、:has 、:parent
可见性过滤器选择器
:hidden 、:visible
属性过滤器选择器
[attribute] 、[attribute=value] 、[attribute!=value] 、[attribute^=value] 、[attribute$=value] 、[attribute*=value] 、[attrSel1][attrSel2][attrSelN]
子元素过滤器选择器
:nth-child 、:first-child 、:last-child 、:only-child
7.表单选择器
:input 、:text 、:password 、:radio 、:checkbox 、:submit 、:image 、:reset 、:button
、:file 、:hidden
表单过滤器选择器
:enabled 、:disabled 、:checked 、:selected