문제

I am trying to travers up the tree and then down again but I do not seem to be able to combine the parent method and a regular selector.

here is what I am trying, I need to get the parent to establish the element that is being clicked and then traverse down again to the selector (#info div.tab)

$( $(this).parent() > '#info div.tab').addClass('hide-tab');
도움이 되었습니까?

해결책

I think you want:

$(this).parent().children('#info div.tab').addClass('hide-tab');

But as IDs must be unique on context page, should be:

$('#info div.tab').addClass('hide-tab');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top