Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM nextSibling Property

HTML DOM nextSibling Property

Element Object Reference Element object

Example

Return the node immediately following a certain element:

document

.

getElementById

(

"

item1

"

)

.

nextSibling

;

Try it »


Definition and Usage

The nextSibling property returns the node immediately following a certain element (at the same level in the tree).

The node is returned as a node object.

Note: If there is no node immediately after the element, it returns null.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the nextSibling property


Syntax

node

.nextSibling

Technical Details

Return Value: The node immediately following, as a node object.
DOM version Core Level 1 Node Object

Element Object Reference Element object