Didier Levy
Didier Levy

Reputation: 3453

jquery select an element within parent

I have the following html:

<div>
  <div class="A">Some details</div<> 
  <div class="B">Some details</div<> 
  <div class="C">Some details</div<> 
</div>

What is the correct jquery syntax to select the div with class="C" starting from $(this) when "this" contains the class=A div?

Upvotes: 0

Views: 132

Answers (3)

Anoop
Anoop

Reputation: 23208

This may solve your problem

$(this).parent().find(">div.C")

OR

$(this).siblings(".C")

Upvotes: 0

pdegand59
pdegand59

Reputation: 13019

This shoudld do the trick.

$(this).parent().find('.C')

Upvotes: 0

Derek Henderson
Derek Henderson

Reputation: 9706

Here you go:

$(this).siblings('div.C');

Upvotes: 1

Related Questions