• 选择器~子元素筛选


    1.jQuery( ":first-child" )

    选择所有父级元素下的第一个子元素。

    $("div span:first-child")————>div下span的第一个与first不同的是可多个

    2.jQuery( ":last-child" )

    选择所有父级元素下的最后一个子元素。

    $("div span:last-child")————>div下span的最后一个与last不同的是可多个

    3.jQuery( ":first-of-type" )

    选择所有相同的元素名称的第一个兄弟元素。

    $("span:first-of-type") ————>比如span有2组选中的就是每组的第一个

    4.jQuery( ":first-of-type" )

    选择所有相同的元素名称的最后一个兄弟元素。

    $("span:last-of-type") ————>比如span有2组选中的就是每组的最后一个

    5.jQuery( ":nth-child(index/even/odd/equation)" )

    选择的他们所有父元素的第n个子元素。

    $("ul li:nth-child(2)")

    $("ul li:nth-child(3n+1)")————》[0,1,2,3,4,5,6,7,8]

    $("ul li:nth-child(n+3)")————》[0,1,2,3,4,5,6,7,8]

    $("ul li:nth-child(even)")————》[0,1,2,3,4,5,6,7,8]

    注:nth-child()中的参数是从1开始

  • 相关阅读:
    连续型随机变量
    离散型随机变量
    vue1.0生命周期
    vue2.0生命周期函数
    vue2.0 vue.set()
    vue2.0 vue.extend()的拓展
    vue2.0 自定义指令详解
    vue2.0 v-model指令
    vue2.0排序应该注意的问题
    vue2.0版本指令v-if与v-show的区别
  • 原文地址:https://www.cnblogs.com/BobSky/p/3155120.html
Copyright © 2020-2023  润新知