This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

nextSibling

Summary

Retrieves the next child node of the parent of the node.

Property of dom/Nodedom/Node

Syntax

Note: This property is read-only.

var nextNode = node.nextSibling;

Return Value

Returns an object of type DOM NodeDOM Node

The next child node of the parent of the node, or null if the node is the last child.

Examples

This example uses the nextSibling property to obtain the next item in the list.

<body>
<ul id="oList">
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
</ul>
<script type="text/javascript">
// returns the list item labeled 'List Item 2'
var oSibling = document.getElementById("oList").childNodes(0).nextSibling;
</script>

</body>

Usage

 Used to Enumerate the DOM tree.

Related specifications

DOM Level 3 Core
Recommendation

Attributions