jQuery之第2章 jQuery選擇器

jQuery選擇器(階梯結構):spa

  一、基本選擇器:對象

      (1)#idelement

      (2).classinput

      (3)elementit

      (4)*io

      (5)selector1,selector2....ast

  二、層次選擇器:class

      (1)$("ancestor  descendant") 後代元素test

      (2)$("parent > child") 子元素表單

      (3)$("prev + next") 同輩元素 等價於$().next();

      (4)$("prev ~ siblings") 同輩元素 等價於 $().nextAll();

  三、過濾選擇器:

    基本過濾選擇器:

      (1):first

      (2):last

      (3):not(selector)

      (4):even

      (5):odd

      (6):eq(index)

      (7):gt(index)

      (8):lt(index)

      (9):header

      (10):animated

      (11):focus

    內容過濾選擇器:

      (1):contains(test)

      (2):empty

      (3):has(selector)

      (4):parent

    可見性過濾選擇器:

      (1):hidden

      (2):visible

    屬性過濾選擇器:

      (1)[attribute]

      (2)[attribute=value]

      (3)[attribute!=value]

      (4)[attribute^=value]

      (5)[attribute$=value]

      (6)[attribute*=value]

      (7)[attribute|=value]

      (8)[attribute~=value]

      (9)[attribute1][attribute2][attributeN]

    子元素過濾選擇器:

      (1):nth-child(index/even/odd/equation)

      (2):first-child

      (3):last-child

      (4):only-child

    表單對象屬性過濾選擇器

      (1):enabled

      (2):disabled

      (3):checked 單選框、複選框

      (4):selected 下拉框

  四、表單選擇器:

      (1):input 選取全部的<input>、<textarea>、<select>和<button>元素

      (2):text 選取全部的單行文本框

      (3):password

      (4):radio

      (5):checkbox

      (6):submit

      (7):image

      (8):reset

      (9):button 選取全部的按鈕

      (10):file

      (11):hidden

 

注意:

  一、選擇器中含有「·」、「#」、「(」、「]」等特殊字符須要轉義。

  二、屬性選擇器中的@符號問題。

  三、選擇器中含有空格的注意事項。

相關文章
相關標籤/搜索