Athapali
Athapali

Reputation: 1089

selecting parent's second sibling

My markup is somthing like this. I need to grab the div's content and my current context is the img tag.

<td>
  <IMG style="CURSOR: hand" border=0 alt=Selected align=absMiddle src="/_layouts/images/rbsel.gif">
</td>

<td>
</td>

<td>
 <div> Some text </div>
</td>

I am trying to select the parent td of the IMG and then select the second sibling of the parent td in oder to get to the div. But it doesn't seem to work. Please help

$("IMG[src*='/_layouts/images/rbsel.gif'].parent('td').nextAll().eq(1)").hide();

Upvotes: 0

Views: 60

Answers (1)

Lee Taylor
Lee Taylor

Reputation: 7984

You'll get more success with this

$("IMG[src*='/_layouts/images/rbsel.gif']").parent('td').nextAll().eq(1).hide();

rather than

$("IMG[src*='/_layouts/images/rbsel.gif'].parent('td').nextAll().eq(1)").hide();

Upvotes: 3

Related Questions