Select children of the same expression in jQuery

Is it possible to select children of the child node of the current context in jQuery using a single expression like this?

$('~ div > span', this) 

Unfortunately, this does not work for me, so I do not believe jQuery supports this type of chaining in an expression. However, I could use the following methods:

 $('> span', $('~ div', this)) $(this).siblings('div').children('span') 

I am looking for a way to get children from my sister using the following API call, or to explain why this is not possible:

 jQuery( expression, context ) 
+4
source share
3 answers

I know this is a little outdated, but I decided to answer if someone tries to do this. find () is the best way to do this

 $(this).siblings('div').find('span'); 

Hope that helps

+5
source

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

+1
source

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

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

0
source

Source: https://habr.com/ru/post/1286489/


All Articles