How do you move an element from under div1 to under div2?

as mentioned, I have a page with the following structure

<div1>
<myEle>
</div1>

<div2></div2>

at first, myEle is under div1, and now I need to move it under div2. Not visually, but structurally. But you can"t use cloneNode, it has to be the one that uses "move".
my ideal state is to "cut" myEle from the document into a free state, and then append it under div2, but I don"t know what to do and whether I can do it.

ask the gods to help

Mar.07,2021

use appendChild:
document.getElementById ('parentEl') .appendChild (document.getElementById (' childEl'))


directly in div2 appendChild, the DOM element is automatically moved over and div1 no longer exists.


css sets the property location to make div1 separate from the document stream to cover div2


can you describe the product requirements?


has drag-related attributes. Learn about


by draggable.

can be handled by variables.

let dom1 = undefined;
let dom2 = undefined;
if(condition) {
    dom1 = <myEle />;
} else {
    dom2 = <myEle />;
}

<div1>{dom1}</div1>
<div2>{dom2}</div2>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e43322-42fc6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e43322-42fc6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?