firstChild method (TreeWalker)
Finds the first child of the current node in the tree represented by the current TreeWalker object. If it exists, it will be made the current node and returned, else the current node is retained and null is returned.
Note: The TreeWalker object and its firstChild method are supported in Internet Explorer from version 9.The TreeWalker object represents the result of the createTreeWalker method as a tree. The elements of the resulting tree refer to the nodes in the document that fulfill the conditions specified for the createTreeWalker method. For further details, please see the page for the TreeWalker object.
You can find the related objects in the Supported by objects section below.
Returns the node if found, else returns null.
Example HTML code 1:
This example illustrates the use of the firstChild method:
Did you find this example helpful?
User Contributed Comments