How can I avoid the .prev().prev().prev()
calls? Is there a shortcut for this?
You can use .prevAll
, combined with eq
or :eq
, since prevAll
returns a set of element in the reverse order starting with the element that's closest to the current element being [0]
, the equivalent to .prev().prev().prev()
would be .prevAll().eq(2)
or .prevAll(':eq(2)')
.
See this simple demo: http://www.jsfiddle.net/QZYHN/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With