Вопрос

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