Home  >  Article  >  Web Front-end  >  The problem of appendchild appending a page element to another page element_javascript skills

The problem of appendchild appending a page element to another page element_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:42:461012browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn