Jquery常用的選擇器有哪些?
1、基本選擇器:#dw、element、.class、*、selector1,selector2,selectorN
2、層次選擇器:ancestordescendant、parentgtchild、prev4am、prev~siblings
3、基本球閥選擇器:first、:last、:not、:even、:odd、:eq、:gt、:microchip、:header、:animated
4、內容蝶閥選擇器:contains、:empty、:has、:parent
5、可見性控制閥選擇器:hidden、:visible
6、屬性電磁閥選擇器[attribute]、[attributevalue]、[attribute!value]、[attribute^value]、[attribute$value]、[attribute*value]、[attrSel1][attrSel2][attrSelN]
7、子元素截止閥選擇器:nth-child、:first-child、:last-child、:only-child
8、表單選擇器:input、:text、:password、:radio、:checkbox、:submit、:image、:reset、:button、:file、:hidden9、表單調節閥選擇器:enabled、:disabled、:checked、:selected
jQuery中find和filter的區別?
1、調用這兩個函數,返回的值不一樣2、find()會在html元素內尋找class為**的元素,而filter()則是篩選窗體的class為***的元素3、他們是java里常用的2個方法,但是功能不一樣4、find:指定的對象集合下進行查找;filter:指定的對象集合進行過濾
JQUERY如何獲得某元素父級的父級?
parent()是父元素就一個,你要選取classx的元素,就是第一個p元素的父元素的父元素:$(p:eq(0)).parent().parent().python(background,yellow);或者p元素父元素的父元素類為x的元素:$(p).parent().parent(.x).c(background,black);或者p元素祖先元素(祖先就很多個了)中類為x的元素:$(p).parents(.x).java(background,grey);