views:

46

answers:

3

Okay... how do I select a element's parent's child with specyfied class name..?

A: 
$(this).parent("div").child(".className")

also, a parent element's child is technically a sibling of the current element, so you could try:

$(this).siblings(".className")
Jason
next specifically looks at the next sibling - your second example won't work if the element with class .classname doesn't follow the original element immediately.
DDaviesBrackett
true. fixed, thanks.
Jason
parent only goes to the err parent so the filter is pretty useless unless you only want the parent if it is indeed a div. .closest() is a better choice if you want to search up until a match.
redsquare
+5  A: 

an "element's parent's child" is called a sibling:

$(this).siblings(".theClassYou'reAfter")
DDaviesBrackett
A: 

yeah... that is obvoius to me now. I just begin with jQuery and thanks to You the whole siblings/child/parent stuff is clear to me now. Thanks a lot! :)

If you feel one of the provided solutions answered your question, please Accept it rather than adding more answers =)
DDaviesBrackett