This article mainly introduces the append () method usage in jQuery. It analyzes the functions and definitions of the append () method and the tips for inserting specified content at the end of a matching element, for more information about how to use the append () method in jQuery, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:
This method inserts the specified content at the end of the matching element.
The element is inserted inside the Matching Element, while the after () method element is inserted outside the matching element.
The append () method has the same functions as the appendTo () method, but its syntax is different, even though its syntax is the same.
Syntax structure:
The Code is as follows:
$ (Selector). append (content)
Parameter List:
Parameters |
Description |
Content |
Specify the content to be inserted. Possible value of content: 1. HTML code-for example (""). 2. Existing elements-for example ($ (". p1 ")). 3. function (index) function-defines the function that returns the inserted element. The index parameter receives the index position of the selector. |
Selector |
Matching Element of content to be inserted |
Instance:
The Code is as follows:
Append () function-script house