December 2013
Intermediate to advanced
384 pages
9h 54m
English
$("tr").slice(2,5); //selects the <tr> elements between 2 and 4 inclusive $("p").slice(1,-1); //selects all <p> elments except the first and last
The .slice(start, [end]) method removes elements before index start and after index end and returns only the items in between. This allows you to break large selections into smaller chunks. The indexes are zero based. A negative end indicates the offset from the end of the list, where –1 is the last element and –2 is the second to the last element.
Read now
Unlock full access