Javascript Reference
Categories: Node

javascript Node nextSibling, previousSibling

@March 15, 2008, 1:22 a.m.
nextSibling, previousSiblingFirefox/Netscape/NN 6 IE 5 Chrome/Safari/DOM 1  

Read-only  

Return a reference to the next or previous node (respectively) in the document tree at the same nested level as the current node. If there is no node in the position indicated by the property name, the property returns null. For a lone text node inside an element node, both properties return null. Node sequence is determined intially by source code order, but script changes to the document tree are reflected in the nodes returned by these properties.

 
Example
 
var nextNode = document.getElementById("elementID").nextSibling;
 
Value

Node object (including text node, HTML element node, etc.) reference.

 
Default

null


Powered by Linode.