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」]')