zoukankan      html  css  js  c++  java
  • Jquery 选择器

    1,基本选择器

    • #id: id选择器
    • element:元素选择器
    • Class:类选择器
    • Select选择器,多项挑出来集合到一起。
    • first:冒号前这个元素的第一个元素
    • last:冒号前这个元素的最后一个元素
    • even:冒号前这个元素的下标为偶数的元素
    • odd:冒号前这个元素的下标为奇数的元素
    • eqindex):获取括号指定下标的元素
    • gtindex):查找大于index索引的元素
    • ltindex):查找小于index索引的元素
    • header:所有的H标签元素。冒号前无元素。
    • :not():括号里为不选择谁,冒号前为父元素。

    2,层级选择器

      • ancestor descendant:ancestor里面的所有descendant元素
      • Parent>child:选择parent元素的子元素
      • Selectr+:获取下一个兄弟元素
      • Selectr~:获取后面所有的兄弟元素

        3,内容选择器:

        • :contains('abc')    指匹配含有abc内容的元素。
        • :empty:匹配内容为空的元素。
        • :has( selecter):选择包含有selecter的选择器
        • :parent:选择作为父元素的元素。

        4,属性选择器:

        • attribute:属性选择为自己
        • Attribuet=“value”,查找属性为value的元素
        • Attribuet!='value”'查找属性不为value的元素
        • Attribute^='value'查找以value开头的属性
        • Attribute$='valu'查找以value结尾的属性

    举例   $("img[src^='a']").css({background:'red'})

    5,子元素选择器

    Type 阵营,child阵营

    • :first-child,first-type-of:
    • :last-child,last-type-of:
    • :nth-child(n),  nth-of-type(n):
    • :nth-last-child(n),nth-last-of-type(n):找倒数第n个元素

    6,表单选择器

    :input:找到input元素

    :text:找到text元素

    :submit:找到submit 元素

  • 相关阅读:
    关于easuiy中的datetimebox与数据库中的时间的交互的使用
    datagrid的getdata和getrows
    easyui中的datagrid的数据加载的问题
    数据库中的数据在datagrid显示footer的显示
    关于网页间传递汉字出现乱码的情况
    使用OpenCL(二) 设备上下文
    使用OpenCL
    复合、源文件组织、类别
    内存管理
    Foundation Kit介绍
  • 原文地址:https://www.cnblogs.com/black-humor/p/5638907.html
Copyright © 2011-2022 走看看