![Insert an element into the DOM after another one](https://javascriptsource.com/wp-content/uploads/2022/10/Insert-an-element-into-the-DOM-after-another-one-702x526.jpg)
Insert an element in the DOM after another one. Call the after()
method on the reference node, and pass in the new node as an argument.
// Create a new element
var newNode = document.createElement('div');
// Get the reference node
var referenceNode = document.querySelector('#some-element');
// Insert the new node after the reference node
referenceNode.after(newNode);
Source
https://vanillajstoolkit.com/reference/dom-injection/element-after/