Example 1 — Official Demo: $("ul li").first()
Take the first list item in document order (jQuery API example).
var $first = $("ul li").first();
console.log($first.length);
console.log($first.text().trim()); How It Works
- Match all items.
$("ul li")builds the full set. - Keep index 0.
.first()drops every later item. - One-element set. Length is
1.

