HTML DOM nextElementSibling Property
Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
HTML DOM nextElementSibling Property
Element Object
Example
Get the HTML content of the next sibling of a list item:
var x =
document.getElementById("item1").nextElementSibling.innerHTML;
<!--
The result of x will be:
Tea (second li)
-->Try it Yourself »
Definition and Usage
The nextElementSibling property returns the element immediately following the specified
element, in the same tree level.
The difference between this property and
nextSibling, is that nextSibling returns
the next sibling node as an element node, a text node or a comment node, while
nextElementSibling returns the next sibling node as an element node (ignores text and comment nodes).
This 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 a 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 of an element, or null if there is no next sibling |
---|---|
DOM Version | Core Level 3 Element Traversal |
Element Object