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

HTML DOM nextElementSibling property

HTML DOM nextElementSibling property

Element Object Reference Element object

Example

Return the HTML content of the next list option:

var

x

=

document

.

getElementById

(

"

item1

"

)

.

nextElementSibling

.

innerHTML

;

Try it »


Definition and Usage

The nextElementSibling property returns the next sibling element after the specified element (the next element node in the same node tree level).

The difference between the nextSibling property and the nextElementSibling property:

The nextElementSibling property is read-only.

Tip: Use the previousElementSibling property to return the previous element of the specified element.

Tip: Use the children property to return any child element of the specified element.


Browser support

property
nextElementSibling 2.0 9.0 3.5 4.0 10.0

Syntax

node.nextElementSibling

Technical Details

Return Value: A Node object representing the next sibling element of the element, or null if there is no next sibling element.
DOM version DOM 3

Element Object Reference Element object