Ticket #4731 (closed enhancement: duplicate)
eq() selector to also work from end of list
|Reported by:||kbwood||Owned by:||john|
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.