CSS selector

div>p(选择直接父元素为div元素的p元素)
div+p(选择div元素同级的第一个p)
div~p (选择div元素同级的全部p)
div,p (选择全部div和p)
div p (选择div元素内部的全部p)html

第一个child编号为1
p:nth-child(3)
p:nth-child(odd)
p:nth-child(even)
p:nth-child(2n+11)htm

p:nth-last-child(n)
p:last-child文档

p:nth-of-type(n)
p:nth-last-of-type(n)
p:last-of-typeinput

p:not(:last-of-type)it

p:only-child(匹配父元素下仅有的一个子元素,equal :first-child:last-child OR :nth-child(1):nth-last-child(1))
p:only-of-type(匹配父元素下使用同种标签的惟一一个子元素,equal :first-of-type:last-of-type OR :nth-of-type(1):nth-last-of-type(1))io

p:root(匹配文档的根元素,对于html文档,就是html元素)
p:empty(匹配一个不包含任何子元素的元素,文本节点也被看成子元素)ast

p:enabled
p:disabled
p:checked
:not(p)test

p:first-of-type(parent下面第一个type是p的孩子)
p:first-child(nth-child(1))(parent下面第一个child, 必须是p)select

$('input[name="aaa"]').attr("checked”) //checked属性的值
$('input[name="aaa"]').prop('checked’) //radiobutton 选中 or 没选中
$('input[name="aaa"]').is(':checked’) //radiobutton 选中 or 没选中filter

$(’select option’).filter(‘:selected’)
$(’select option’).filter(‘[selected]’)

<input type="text" name="test" value="hello world" />
$(‘:text’).val($(‘’).val());

^= (start with)$= (ends with)= (exactly equal) != (not equal)*= (contains)e.g. $(‘[id^=“item”]')

相关文章
相关标签/搜索