jQuery append() Method
The append() method in jQuery is used to insert some content at the end of the selected elements.
$(selector).append( content, function(index, html) )
Parameters: This method accepts two parameters as mentioned above and described below:
- content: It is a required parameter and is used to specify the content which is to be inserted at the end of selected elements. The possible value of contents are HTML elements, jQuery objects, and DOM elements.
- function(index, html): It is an optional parameter and is used to specify the function that will return the content to be inserted.
- index: It is used to return the index position of the element.
- html: It is used to return the current HTML of the selected element.
Example 1: This example appends the content at the end of the paragraph and list.
Example 2: This example appends the content at the end of the paragraph.