Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 17:07:22
Original
1714 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template