tags:

views:

510

answers:

2

Is it possible to select the children of a sibling of the current context in jQuery using a single expression similar to this?

$('~ div > span', this)

Unfortunately this does not work for me so I don't believe jQuery supports this type of chaining in an expression. I was however able to get the following to methods to work:

$('> span', $('~ div', this))

$(this).siblings('div').children('span')

So in summary I am looking for a way to get the children of a sibling using the following API call, or for an explanation on why it is not possible:

jQuery( expression, context )

A: 

Try using $(this).next('div').children('span')

http://docs.jquery.com/Traversing/next

Spencer Ruport
This is not an answer to the question. The OP already used a similar approach.
molf
A: 

you could try $(this+"+div>span");

Steve Paulo