Bug Tracker

Opened 11 years ago

Closed 11 years ago

#4731 closed enhancement (duplicate)

eq() selector to also work from end of list

Reported by: kbwood Owned by: john
Priority: minor Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

I had occaision to want to select the second last item in a list but was unable to do that with the existing selector. I propose allowing a negative number as a parameter to the eq, nth, lt, and gt selectors to select from the end of the list rather than the start. For example, $('li:eq(-2)') would select the second last li, while $('li:gt(-3)') would select the last two li's. The attached patch shows the necessary changes to 1.3.2.

Attachments (1)

jquery-1.3.2-eq.patch (1.0 KB) - added by kbwood 11 years ago.
Patch for eq() selector to also work from end of list

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by kbwood

Attachment: jquery-1.3.2-eq.patch added

Patch for eq() selector to also work from end of list

comment:1 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #4262; I've referenced this ticket there.

Note: See TracTickets for help on using tickets.