Home > Web Front-end > JS Tutorial > Example of usage of appendTo() method in jQuery_jquery

Example of usage of appendTo() method in jQuery_jquery

WBOY
Release: 2016-05-16 16:21:39
Original
1137 people have browsed it

The example in this article describes the usage of the appendTo() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method inserts the matching element into the end of the specified element, and the insertion position is inside the element.
The appendTo() method has the same function as the append() method, but the syntax is different, although the form is the same.

Grammar structure:

Copy code The code is as follows:
$(selector).appendTo(content)

Parameter list:
参数 描述
selector 要被插入的匹配元素。
content 要被插入匹配元素的元素。

Example code:

Copy code The code is as follows:






appendTo() function-Script Home





I am the content of p


I am div




In the above code, when the button is clicked, the p element can be moved to the end of the inside of the div element.

I hope this article will be helpful to everyone’s jQuery programming.

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