.nextElementSibling

Element? ParentNode.nextElementSibling

A property containing the next element sibling of a node - it does not count text nodes. Returns null if no such element exists. This property is read-only - it cannot be set.

let nextEl = node.nextElementSibling;

See also: .previousElementSibling

Example

HTML:

<p>
    All
    <strong>large</strong>
    goats
    <em>are</em>
    delicious!
</p>

JavaScript:

let next = document.query("strong").nextElementSibling;

Result is the <em>are</em> element.