Javascript Reference
Categories: children

javascript children children[ ]

@March 15, 2008, 1:22 a.m.
children[ ]Firefox/Netscape/NN n/a IE 4 Chrome/Safari/DOM n/a  

Read-only  

Returns an array of all first-level HTML element objects contained by the current element. This collection differs from the all[ ] collection in that it contains references only to the immediate children of the current element (whereas the all[ ] collection transcends generations). For example, document.body.children[ ] might contain a form, but no reference to form elements nested inside the form. Items in this array are indexed (zero-based) in source code order. In contrast to the childNodes[ ] array, the scope of this property is the element, not the node. See the children object.

 
Example
 
for (var i = 0; i < elementRef.children.length; i++) {
		    if (elementRef.children[i].tagName == "FORM") {
		        // operate on a form element
		    }
		}
 
Value

Array of element object references.

 
Default

Array of length zero.


Powered by Linode.