jQuery slice () method
Definition and Usage
slice () method selected based on a subset of the index element.
Belonging to the set is a subset of a large part of the collection.
This method is used by the start and end points to limit the combination of elements in the selection: start parameter is to create a subset of the index at the beginning (starting from 0), stop parameter is an optional end point.
grammar
$(selector).slice( start,stop )
参数 | 描述 |
---|---|
start | 必需。规定开始选取元素的位置。索引号从 0 开始。 注意:如果是负数,则指示从被选元素的末端开始选取元素,而不是从头开始。 |
stop | 可选。规定结束选取元素的位置。如果省略,则选取范围会在集合末端结束。索引号从 0 开始。 注意:如果是负数,则指示从被选元素的末端开始选取元素,而不是从头开始。 |
More examples
start and stop
How to use these two parameters to select from the start point to the end point of <p> elements.
Use negative
Use negative from the end choose <p> element, rather than starting from scratch.
Two negative parameters
Use start and stop negative parameters to start selecting <p> element from the end.