The children is a property of element which returns the child elements of an element as objects.
The main difference between children and childNodes property is that children work upon elements and childNodes on nodes including non-element nodes like text and comment nodes.
Example 1: This example illustrates the property of childNodes.
Example 2: This example illustrates the property of children.
- Google Chrome
- Mozilla Firefox
- Apple Safari
- Internet Explorer/Edge
- HTML | DOM childNodes Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.