![]() |
VOOZH | about |
The DOM children property is used to return an HTML collection of all the child elements of the specified element. The elements in the collection can be accessed by index numbers. It differs from childNodes as childNodes contain all nodes (i.e. it includes text and comment nodes as well) but on the other hand, children contain only element nodes. This is a read-only property.
Syntax:
element.children
Return Value: It returns a collection of element nodes that can be accessed by indexing.
Example 1: This example returns the number of list items.
Output:
Example 2: In this example, we will use DOM children property
Output:
Supported Browsers: The browser supported by DOM children property is listed below: