Example 1 — Official: nextAll() + addBack()
Keep the starting item and everything after it (jQuery API demo).
$("li.third-item").nextAll().addBack().append(" [kept]"); How It Works
- Start. Select the third list item.
- Narrow.
.nextAll()keeps only items 4 and 5. - Merge.
.addBack()brings item 3 back into the set.

