Control Freak
Control Freak

Reputation: 13213

How to get a range of objects in a selector

If I have a list of 10 links, and I want to select all the links after the first 4, How?

I was looking at :eq() but that doesn't seem to solve my issue since its specific, rather than a range.

Look for something like $("a:eq(>4)") or something, hope it makes sense.

Upvotes: 2

Views: 43

Answers (2)

Ricardo Lohmann
Ricardo Lohmann

Reputation: 26320

Use slice. It's faster.

$('a').slice(4);

Upvotes: 1

Ram
Ram

Reputation: 144669

You can use :gt selector:

$('a:gt(3)');

Upvotes: 4

Related Questions