What's Zepto.js alternative to jQuery's $(this).parent().parent().find('.active')?

StackOverflow https://stackoverflow.com/questions/4387748

  •  10-10-2019
  •  | 
  •  

문제

What's Zepto.js alternative to jQuery's $(this).parent().parent().find('.active')?

도움이 되었습니까?

해결책

I don't see a .parent() method in the API, so you might just have to do this (untested!):

$($(this).get(0).parentNode.parentNode).find('.active').hide();

다른 팁

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).

zepto has something like Element#upfrom 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')

Zepto has since implemented the .parent() method. See http://zeptojs.com/#parent

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top