2

I just want to go up a parent node, so I can do a .find inside that parent node.

In a sense, I want to .find a sister.

Crescent Fresh
  • 115,249
  • 25
  • 154
  • 140
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080

2 Answers2

7
$('el').siblings('li');

or

$('el').parent().find('li');
CodeJoust
  • 3,760
  • 21
  • 23
0

To traverse to a closest possible parent node

$('.someclassname').closest('.parentclassname')

And to find a node inside that

$('.someclassname').closest('.parentclassname').find('.findwhatever')

If the node you are finding is on same level of your current node say

<div class="testcls">
  <p class="child1">child1</p>
  <p>child2</p>
</div>

In above child2 is sibling of child1 so you can find such siblings using

$('child1').siblings();
Nagarjun
  • 2,346
  • 19
  • 28