zoukankan      html  css  js  c++  java
  • 遍历及过滤 first(), last() 和 eq() filter() 和 not()

    三个最基本的过滤方法是:first(), last() 和 eq(),它们允许您基于其在一组元素中的位置来选择一个特定的元素。其他过滤方法,比如 filter() 和 not() 允许您选取匹配或不匹配某项指定标准的元素。

    $(document).ready(function(){
      $("div p").first();
    });

     首个<div> 元素内部的第一个 <p> 元素

    $(document).ready(function(){
      $("div p").last();
    });

    最后一个 <div> 元素中的最后一个 <p> 元素


    $(document).ready(function(){
      $("p").eq(1);
    });
    选取第二个 <p> 元素(索引号 1)


    $(document).ready(function(){
      $("p").filter(".intro");
    });
    返回带有类名 "intro" 的所有 <p> 元素


    $(document).ready(function(){
      $("p").not(".intro");
    });
    返回不带有类名 "intro" 的所有 <p> 元素
  • 相关阅读:
    flex-direction
    flex-grow
    Push API
    ServiceWorker.state
    Using Service Workers
    Promise.then
    Promise()
    Using promises
    node-rsa
    async.waterfall
  • 原文地址:https://www.cnblogs.com/zouyun/p/7687081.html
Copyright © 2011-2022 走看看