Moving an HTML element without an element id in JavaScript

I need to move an HTML element to a location “after” the indicated element id

<div class="some">
  <div id="dest">blablabla</div>
</div>

<div id="source">
  test
</div>

I want to move the div “source” after “dest”:

<div class="some">
  <div id="dest">blablabla</div>
  <div id="source">
     test
  </div>
</div>

The parent of “dest” doesn’t have an ID!

Answer

You can use ChildNode.after() for that

The ChildNode.after() method inserts a set of Node or DOMString objects in the children list of this ChildNode’s parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes.

function move() {
  let dest = document.getElementById("dest");
  let source = document.getElementById("source");

  dest.after(source);
}
<div class="some">
  <div id="dest">blablabla</div>
</div>
<input type="button" value="move" onclick="move()">
<div id="source">
  test
</div>