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

 

注意:

  一、选择器中含有“·”、“#”、“(”、“]”等特殊字符须要转义。

  二、属性选择器中的@符号问题。

  三、选择器中含有空格的注意事项。

相关文章
相关标签/搜索