Home  >  Article  >  Web Front-end  >  The difference between append and appendTo and the usage of appendChild_jquery

The difference between append and appendTo and the usage of appendChild_jquery

WBOY
WBOYOriginal
2016-05-16 17:07:221655browse

append() is preceded by the object to be selected, followed by the element content to be inserted into the object
appendTo() is preceded by the element content to be inserted and is a Jquery object, and followed by the object to be selected

Example:
$('#a').append('content');
$('

content
').appendTo($('#a'));

Note that appendTo must be preceded by a Jquery object.

appendChild(Node) This method generally adds a node after the last child node of the specified element node

But if Node is a DOM object in the page, then it is not adding a node, that is Move node directly.

appendChild can be understood as moving an element. If you want to make a copy of the past, you must clone it in advance
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