Selecting the first "n" items with jQuery

Solution 1:

You probably want to read up on slice. Your code will look something like this:

$("a").slice(0,20)

Solution 2:

Use lt pseudo selector:

$("a:lt(n)")

This matches the elements before the nth one (the nth element excluded). Numbering starts from 0.