Since the jQuery object is an Array object, I would probably just use this instead of creating an array of individually wrapped objects.
var childElements=$(elem).children();
If you intend to add more elements, you can .push()always have .add()new elements. It also ensures that you do not have duplicates.
var childElements= $();
function getChildren(elem){
childElements = childElements.add( $(elem).children() );
}
source
share