.slice(start [, end]) (since jQuery 1.1.4) reduces the matched set to a subset by zero-based index range. Indexes refer to position in the jQuery object — not the DOM tree. Patterned after JavaScript Array.prototype.slice.
Select a set, pass a start index, optionally an exclusive end.
Select the collection (e.g. $("li")).
Call .slice(start) to keep from that index to the end.
Or .slice(start, end) — end is not included.
Use negatives to count from the end: .slice(-2) = last two.
Chain styling or other methods on the subset.
Piece
Required?
Role
Matched set
Yes
Collection to reduce
start
Yes
0-based start (negative = from end)
end
No
Exclusive stop; omit → through last
Return value
—
New jQuery set (0 or more)
Pseudocode
Pseudocode
call $(set).slice(start, end?)
n = set.length
resolve start (and end) like Array.slice:
if negative → n + value
clamp to [0, n]
if end omitted:
end = n
result = elements from index start up to (not including) end
return result as a new jQuery object
Reference
Cheat Sheet
Keep index methods side by side.
Topic
Detail
Syntax
.slice(start [, end])
Since
jQuery 1.1.4
Index base
Zero-based in the jQuery set
end
Exclusive
Negative
Offset from the end
vs .eq()
Range vs one element
Model
Array.prototype.slice
DOM change?
No — query only
Try it
Live Preview
From five list items, try common .slice() ranges and compare with .eq().
.slice() has been part of jQuery since 1.1.4. It works in every browser that runs your loaded jQuery version — same indexing rules as Array.prototype.slice.
✓ Stable · jQuery 1.1.4+
jQuery .slice()
Supported across jQuery 1.x (1.1.4+), 2.x, and 3.x. Prefer a current jQuery 3.x build. Zero-based, end-exclusive, negative offsets from the end.
100%With jQuery
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.slice()Universal
Bottom line: Safe for ranges, trailing subsets, and simple pagination windows. Remember: end is exclusive.
Analysis
Performance Notes
Approach
Cost
Best for
.eq(n)
Cheapest
One element
.slice(a, b)
Cheap
Contiguous index range
.filter(fn)
Per-element
Non-contiguous rules
Prefer a tight starting selector, then .slice(). Slicing only copies references into a new jQuery object — it does not walk the DOM tree.
One line:.slice(start, end) keeps a half-open index range — just like Array.prototype.slice.
Frequently Asked Questions
.slice(start [, end]) reduces the current jQuery collection to a subset within a zero-based index range. It returns a new jQuery object — the original set is unchanged.
Exclusive, like Array.prototype.slice. .slice(2, 4) includes indexes 2 and 3 only — not index 4. If end is omitted, the range continues to the end of the set.
Negative start or end counts from the end. On a five-item list, .slice(-2, -1) selects index 3 (list item 4) — from two from the end up to but not including one from the end.
.eq(n) returns exactly one element at index n. .slice(start, end) returns zero or more elements in a range. Use .eq() for a single pick; use .slice() for batches or trailing subsets.
It is patterned after the native array method: zero-based indexes, end exclusive, and negative offsets from the end. It operates on a jQuery object of DOM elements and returns another jQuery object.
jQuery clamps to valid bounds — no error is thrown. An empty or partial range returns fewer elements. For example, .slice(10) on a five-item set returns an empty jQuery object.