zoukankan      html  css  js  c++  java
  • $("selector").slice(start, end)

    $("selector").slice(start, end) slices matched set into subset specified by start and optional end.

    Example 1: $("div").slice(0,1) will first find all <div> then slice the mathced set into subset starting from element at index=0 and ending "but NOT including" elment at index=1.

    <div>A</div>  // index = 0 
    <div>B</div>  // index = 1 
    <div>C</div>
    

      

    Matched set is a set of elements matching selector. For example, in Example 1 matchted set is set of elements matching $("div") selector
    <p>p-1</p>
    <div id='someID'>div-1</div> //index = 0
    <div class='someClass'>div-2</div> //index = 1
    <div>div-3</div> //index = 2
    <span>span-1</span>
    

      

    Example 2: $("div").slice(1) will first find all <div> then slice the mathced set into subset starting from element at index=1 to the last element.

    <div>A</div>  // index = 0 
    <div>B</div>  // index = 1 
    <div>C</div>  // index = 2 
    

      

    Example 3: $("div").slice(-2) will first find all <div> then slice the mathced set into subset starting from element at index=-2 "second element from the last" to the last element.

    <div>A</div>  // index = 0 & index = -3 from last 
    <div>B</div>  // index = 1 & index = -2 from last 
    <div>C</div>  // index = 2 & index = -1 from last 
    

      

  • 相关阅读:
    存在和本质
    数据库的日志机制
    【msql】关于redo 和 undo log
    乐观锁是基于比较的无锁并发控制机制
    两段锁协议和防止死锁的一次封锁法
    并发编程沉思录
    什么是B-Tree
    二叉树与b树的性能区别:计算、层级与io
    认知模型
    复杂性、认知与心理学
  • 原文地址:https://www.cnblogs.com/hephec/p/4574412.html
Copyright © 2011-2022 走看看