views:

244

answers:

2

I looked through documentation and there seems to be no way to get an array of children of a given node...

something like

 if (parentNode.hasChildren() == true) {
        alert('yay');

        if (parentNode.children == null) {
            alert('what the???');
        }
 }

this code will output 'yay', (i use a node that has children) but parentNode.children is null because 'what the??' is also being output....

Is there any way to get an array of children of a particular node?

In the case above, i would expect the parentNode to have an array of children, but there seems to be no way to get the children, only add and remove them.

Is my understanding correct?

A: 

try to use

parentNode.children()

jQuery children API

Juraj Blahunka
i did already. no luck
gnomixa
A: 

It's parentNode.childList

mar10
thanks! interestingly enough, it's not mentioned in the documentation at all:) unless I missed it.
gnomixa