How to move one HTML element inside another using JavaScript?
Hello everyone! I just started learning JavaScript and came across a task: I need to dynamically move a `
` block inside another container `
`. The problem is that after moving, the element should be actually moved, not copied — that is, it should disappear from the old location and appear in the new one.
Here is my markup:
```html
```
I tried using `appendChild`, but it seems to only work when creating new elements. And if the element already exists in the DOM — does it get copied or moved? Also, what about jQuery? Many people recommend using `.appendTo()`, but I want to understand pure JavaS
I am the element that needs to be moved
Insert here
No answers yet.
Log in to leave an answer