What's Zepto.js alternative to jQuery's $(this).parent().parent().find('.active')
?
Asked
Active
Viewed 2,340 times
5
4 Answers
9
This question is about 4 months old and the Zepto framework gets updated pretty regularly.
$(this).parent().parent().find('.active')
now works.
According to the git repo source tree, this support was added in Dec 20, 2010 by Mislav Marohnić (commit hash 784de340).

Mauvis Ledford
- 40,827
- 17
- 81
- 86
3
zepto has something like Element#up
from prototype to search up the ancestry. It's called closest
. You'll need to have a class or know who is the parent.
$(this).closest("div.parentclass").find('.active')

evilchelu
- 31
- 2
-
Thank you. I doubt if it's faster than karim79's solution, tho. – Ken Dec 10 '10 at 05:15
1
Zepto has since implemented the .parent() method. See http://zeptojs.com/#parent

Bobby Grace
- 226
- 1
- 3