Home > Article > Web Front-end > The problem of appendchild appending a page element to another page element_javascript skills
Generally, you create elements yourself and then append them to the page. But what if the elements on the page itself are appended to another page element?
looks like :
The element does become a child of another element
The element itself is gone.
In other words, disappeared. Instead of copying
This is indeed the case, but I think this mechanism is very strange
Can't it be a copy, that is, 1 becomes a child element of 2, and then 1 is still there.
It’s not that the demand is generally like this. On the contrary, the demand is generally to delete the original one, such as this case
But logically think about it: first append, and then delete the original 1 element ourselves
Good thing now, append also has its own remove function.
Be careful.