Skip to main content

Bug Tracker

Side navigation

#4731 closed enhancement (duplicate)

Opened June 05, 2009 09:04AM UTC

Closed June 08, 2009 01:01AM UTC

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:

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 June 05, 2009 09:05AM UTC.

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

Change History (1)

Changed June 08, 2009 01:01AM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

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