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

    总结一下常用的jQuery选择器

    选择器 实例 选取
    * $("*") 获取所有元素
    #id $("#myid") 获取id为myid的元素 
    .class $(".myclass") 获取class为myclass的元素
    .class.class $(".myclass1.myclass2") 获取既包含myclass1 有包含myclass2的元素
    element $("p") 获取所有p元素
    :frist $("p:frist") 第一个p元素
    :last $("p:last") 最后一个p元素
    :even $("tr:even") 所有偶数tr元素
    :odd $("tr:odd") 所有奇数tr元素
    :eq(index) $("ul li:eq(3)") 获取ul下的第四个li(index从0开始)
    :gt(no) $("ul li:gt(3)") 获取第四个li之后的li(index大于3的)
    :lt(no) $("ul li:lt(3)") 获取第四个li之前的li(index小于3的)
    :not(selector) $("input:not(:empty)") 获取所有不为空的input
    :header $(":header") 获取h1-h6
    :animated   所有动画元素
    :empty $(":empty") 无子节点的元素
    :hidden $("p:hidden") 所有隐藏的p元素
    [attribute] $("[href]") 获取有href属性的元素
    [attribute=value] $("[href='#']") 获取href属性为# 的元素
    [attribute!=value] $("href!='#'") 获取href属性不为#的元素
    [attribute$=value] $("href$='.jpg'") 获取href属性中包含.jpg的元素
    :input $(":input") 获取所有input元素
    :text $(":text") 所有type为text的input元素
    :button $(":button") 所有type为button的input元素
    :submit $(":submit") 所有type为submit的input元素
    :radio $(":radio") 所有type为radio的input元素
    :checkbox $(":checkbox") 所有type为CheckBox的input元素
    :enabled $(":enabled") 所有激活的input元素
    :disabled $(":disabled") 所有禁用的input元素
    :selected $(":selected") 所有被选取的input元素
    :checked $(":checked") 所有被选中的input元素
  • 相关阅读:
    数据库索引分析(一)
    对象的序列化(串行化)分析(一)
    Java 集合类 TreeSet、TreeMap
    查找杀死指定进程delphi
    delphi集合的用法
    debian 删除软件
    linux 各种国内源更新 (source)
    screen 命令使用记录
    Python 常用import
    常用Python函数
  • 原文地址:https://www.cnblogs.com/aizz/p/9497374.html
Copyright © 2011-2022 走看看