nextSibling (W3C DOM Core property)
var sibling = node.nextSibling;
In the example above, if node has a sibling immediately
after it (a node of any type, which shares its parent with
node), the sibling variable will be
a reference to that node; otherwise it will be
So in the following HTML example, the
li element is the
nextSibling of the first, but has no
nextSibling of its own:
<h2>Shopping list</h2> <ul> <li>Chocolate</li> <li>More chocolate</li> </ul>
Actually this example is idealized, and in some browsers the second
li element may not in fact be the
nextSibling of the first; that's because some
browsers count intermediate whitespace as text nodes, and would
therefore consider the
nextSibling to be the
whitespace between the
For more about this behavior please see DOM Core.
The node immediately after
this node (ie. both nodes have the same parent and are next to each other
childNodes collection), or
null if there is no such node.
This property is readonly.
No known issues.
There are no comments yet.