$("selector").slice(start, end)
2015-06-14 00:04
543 查看
$("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=0and 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=1to 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
相关文章推荐
- BestCoder#44 ZYB loves Xor I
- mysql日志
- 如何处理高并发情况下的DB插入
- 搞定linux上MySQL编程(六):C语言编写MySQL程序(结)
- 闪讯最新版WIFI共享+广告弹窗一招屏敝无反弹
- MS SQL Sever数据库还原
- 老板也是一个工种,也是一种技能
- VTR-to-Bitstream 3 ToolChain Implementation on Linux
- 事件绑定on()、bind()与delegate() 方法详解
- 图片墙效果
- JavaScript中使用自然对数ln的方法
- JavaScript中的Math.LOG2E属性使用详解
- 简介JavaScript中Math.LOG10E属性的使用
- JavaScript中使用Math.PI圆周率属性的方法
- JavaScript中的Math.SQRT1_2属性使用简介
- JavaScript中Math.SQRT2属性的使用详解
- 介绍JavaScript中Math.abs()方法的使用
- JavaScript中的acos()方法使用详解
- JavaScript中反正弦函数Math.asin()的使用简介
- 浅谈JavaScript中的Math.atan()方法的使用