I am working on a script that will push each child element into a global array (for processing later on in my script) but for some reason its not actually pushing the element into the array.
Code:
var childElements=new Array();
function getChildren(elem){
$(elem).children().each(function(index, value){
childElements[index] = $(this);
});
}
Am I doing something wrong?
Thanks! Dennis
Edit (working code):
var childElements = $();
function getChildren(elem){
childElements = childElements.add( $(elem).children() );
console.log(childElements);
}