• jquery的选择器


    基本选择器

    #id  $("#id")

    .class   $("#.class)  

    element  $("p")  选择p标签

    *           $("*")   选择所有元素

    select1,select2,select3    $("div,span,p")  选择所有div,span,p元素

    select#id.class     $("p#head")  选择含有id为head的p元素

    层次选择器

    $("div   span")   选择div元素下的所有span元素

    $("div>span")   选择div元素下的元素名是span的子元素

    $(".one+div")   选择class是one的下一个div兄弟元素(紧邻兄弟元素)

    $(".one~div")   选择class是one后面的所有div兄弟元素(所有兄弟元素)

    表单选择器

    :input     选择所有input,textarea,select,button

    :text      选择所有单行文本框

    :password  选择所有密码框

    :radio  选择所有单选框

    :checkbox   选择所有多选框

    :submit   选择所有提交按钮

    :image    选择所有图片按钮

    :reset      选择所有重置按钮

    :button     选择所有按钮

    :file           选择所有上传域

    :hidden     选择所有不可见元素

    过滤选择器

    基本过滤

    :first        选取第一个

    :last         选取最后一个

    :even       选择偶数

    :odd        选择奇数

    :eq(index)   等于

    :gt(index)    大于

    :lt(index)    小于

    :not(select)    去除选择元素

    :header    h1——h6

    :animated  选择所有正在执行的动画元素

    内容过滤

    :contains()  $("div:contains('我')")    选取包含文本“我”的div元素

    :empty       $("div:empty")         选择div空元素

    :has(select)  $("div:has('p')")   选择包含p元素的div元素

    :parent     $("div:parent")   选择有子元素的div

    可见性过滤

    :hidden

    :visible

    属性过滤

    [attribute]

    [attribute=value]

    [attribute!=value]

    [attribute^=value]

    [attribute$=value]

    [attribute*=value]

    [select1][select2][selectN]

    子元素过滤

    :nth-child()

    :first-child

    :last-child

    only-child

    表单对象属性过滤

    :enabled

    :disabled

    :checked

    :selected

  • 相关阅读:
    TVM性能评估分析(三)
    TVM性能评估分析(二)
    TVM性能评估分析(一)
    飞腾上实体名单?
    华为不造车,广汽合作智能驾驶
    异构计算编程
    服务器硬件层次架构
    为何说要多用组合少用继承?如何决定该用组合还是继承?
    极客时间学习
    如果学不好编程,就看看这个吧
  • 原文地址:https://www.cnblogs.com/fslnet/p/2794468.html
Copyright © 2020-2023  润新知