The slice() is an inbuilt method in jQuery which is used to select a subset of elements based on its index. The subset is a set that may be a part of a large set.
Parameter: It accepts two parameters which are specified below-
- para1: It specifies that where to start the selection of the elements.
- para2: It is optional and it specifies where to stop the selection of the elements.
Return Value: It returns the subset of the selected element.
jQuery code to show the working of slice() method:
In this code, all paragraph element from index 1 to 3 get highlighted.
- TypeScript | String slice() Method with example
- TypeScript | Array slice() Method
- Nodejs lodash.slice() function
- Underscore.js _.iterators.slice() Method
- jQuery | jQuery.fx.interval Property with example
- jQuery | jQuery.fx.off Property
- jQuery | jQuery.support Property
- jQuery | jquery Property
- jQuery | prepend() with Examples
- jQuery | dblclick() with Examples
- jQuery | offset() with Examples
- jQuery | children() with Examples
- jQuery | Hide/Show, Toggle and Fading methods with Examples
- jQuery | focusin() with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.