Returns a reference to the next child element of the current element's parent.
Note: The nextElementSibling property is supported in Firefox from version 3.5 and Internet Explorer from version 9.The next sibling node and the next sibling element can be different. A node is an element node if it's nodeType is 1 (Node.ELEMENT_NODE). Text nodes and comment nodes are not element nodes. If you need the next sibling node of an element, use the nextSibling property.
The children collection contains all child elements of an element in source order. If you want to iterate through the child elements of an element, you can also use it.Note: The children collection also contains the child comment nodes in Internet Explorer before version 9. In other browsers, it only contains the element nodes.
You can find the related objects in the Supported by objects section below.
This property is read-only.
Reference to the next sibling element or null if it does not exist.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the firstElementChild and nextElementSibling properties:
Did you find this example helpful?
User Contributed Comments