The detach method in jQuery
But the detach method, unlike the remove method, deletes the selected elements with the possibility of restoring them.
Let's say we have the following HTML code:
<p id="test">text</p>
<div></div>
Let's first remove the element #test using detach, and then restore it elsewhere using the appendTo method (this is possible because the $elem variable still has a reference to it after deletion):
let $elem = $('#test');
$elem.detach(); // delete element
/*
We insert the element back into the page (not necessarily in the same place where it was):
*/
$elem.appendTo('div');
Let me remind you that the dollar sign in the variable $elem is written to indicate that it stores a set of jQuery.
Remove p from id: #test with detach, then insert it before h3.