.after()
void Element.after((Node or String)... nodes)
Warning! Current browsers do not yet support
.after()
, please
use a polyfill
until they do.
Insert one or more nodes after a node.
node.after(nodes);
Inserts nodes after node, while replacing strings in nodes with equivalent text nodes.
See also: .before()
Example
HTML:
<p>
All
<strong>large</strong>
goats
<em>are</em>
delicious!
</p>
JavaScript:
let el = document.createElement("strong");
el.textContent = "very";
document.query("em").after(" ", el);
Resulting HTML:
<p>
All
<strong>large</strong>
goats
<em>are</em>
<strong>very</strong>
delicious!
</p>