jQuery选择器

选择器动画

实例spa

解释ci

基本选择器element

*get

$(*)input

选取全部元素io

#idtable

$(“#a”)ast

选取id=a的元素class

.class

$(“.b”)

选取class=b的元素

element

$(“p”)

全部<p>元素

.class.class

$(“.a.b”)

选取全部class=a且class=b的元素

基本过滤选择器

:first

$(“p:first”)

选取第一个p元素

:last

$(“p:last”)

选取最后一个p元素

:odd

$(“p:odd”)

选取全部奇数位上的p元素

:even

$(“p:even”)

选取全部偶数位上的p元素

:ep(n)

$(“p:eq(n)”)

选取第n位p元素(index从0开始)

:gt(n)

$(“li:gt(n)”)

选取第n位以前的全部li元素(不包含第n位)

:lt(n)

$(“li:lt(n)”)

选取第n位以后的全部li元素(不包含第n位)

:root

$(“p:root”)

选取p的根元素(不写标签时表明选取全局的根元素)

:header()

$(“p:header)

选取P标签里的全部标题(不写标签时表明选取全局的标题)

:lang

$(“p:lang(language)”)

给P标签选取指定的语言(不写标签时表明选取全局的标题)

:not

$(“li:not(.active)”)

选取除了.active之外的元素

:hidden

$(“p:hidden”)

隐藏全部P标签

:visible

$(“p:visible”)

显示全部p标签

:target

$(“:target”)

选取全部目标状态的元素

:anmated

$(“p:anmated”)

获取正在运行的动画

子元素过滤器

:first-child

$(“div p:first-last”)

选取div里第一个标签为P的子元素

:last-child

$(“div p:last-child”)

选取div里最后一个为标签p的子元素(不限位置)

:first-of-type

$(“div p:first-of-type”)

获取div里出现的第一个p标签(不限位置)

:last-of-type

$(“div p:last-of-type”)

获取div里最后出现的p标签(不限位置)

:nth-child(n)

$(“div p:nth-child(2)”)

获取div里第二个p标签(下标从1开始)

:nth-of-type(n)

$(“div p:nth-of-type(2)”)

获取div里第二个出现的p标签(下标从0开始)

:nth-last-of-type(n)

$(“div p:nth-last-of-type(n)”)

获取div里倒数第几个出现的p标签

:only-child

$(“div p:only-child”)

获取div里惟一一个子元素p

:only-of-type

$(“div p:only-of-type”)

获取同辈div里惟一一个标签为p的标签

:only-of-type(even/odd)

$(“div p:only-of-type(even/odd)”)

获取div里全部为奇数或偶数的P标签(下标从1开始)

内容过滤器

:contains()

$(“p:contains(123)”)

获取p标签里全部包含“123”的标签

:empty

$(“p:empty”)

获取p标签里没有内容的全部元素(空格也算内容)

:has()

$(“div:has(P)”)

获取全部含有p标签的div

:parent

$(“div:parent”)

获取全部元素中柚子元素的div(包括文本节点)

表单选择器

:text

$(“:text”)

选取全部type为text的字段或type没有属性的

:password

$(“:password”)

选择全部type为password的

:reset

$(“:reset”)

选择全部type为reset(重置)的

:button

$(“:button”)

选择全部type为button(按钮)的

:checkbox

$(“:checkbox”)

选择全部type为checkbox(多选)的

:radio

$(“:radio”)

选择全部type为radio(单选)的

:file

$(“:file”)

选择全部上传域

:image

$(“:image”)

选择全部图像按钮

:input

$(“:input”)

选取全部input、textarea、select、button元素

:enabled

$(“:enabled”)

选取全部可用的input

:disabled

$(“:disabled”)

选择全部不可用的input

:select

$(“:select”)

被选中状态的option元素

:checked

$(“:checked”)

被选中状态的input元素(有checked的)

:focus

$(“:focus”)

选取页面进去就有焦点的input

相关文章
相关标签/搜索