views:

41

answers:

4

$('something').parents('selectors') lets me move several levels up the DOM at once, versus parent() which unsurprisingly returns the current element's immediate parent. Unfortunately (though logically), children() does not operate like parents() and instead only returns the element's immediate children, similar to how parent() works. I'm sure that I could whip up something that would get all appropriate descendants no matter how deep, but I'm wondering if there already is some relatively simple way to do this. Any chance?

+1  A: 
$('something *');

… or if you already have a jQuery object:

$('*', foo);
David Dorward
And `$("*", foo);` is synonymous with `$(foo).find("*");`
Peter Ajtai
+2  A: 

Something like .find('*'), or $('div#foo *')

meder
+2  A: 

Use the find such as find('selectors')

elektronikLexikon
+1  A: 

Cant you just use descendants?

I think your after something like

$('#something').childrens('.selectors');

Can you not jsut do:

$('#something *');

Or have i totally missed the point of your question?

RobertPitt