//children holds the NodeList Object with the child nodes var i; for (i=0, i < children.length, i++) //loop over all child nodes return children.item(i).nodeName; //return the names