Home » jQuery append()

jQuery append()

by Online Tutorials Library

jQuery append()

The jQuery append() method is used to insert specified content as the last child (at the end of) the selected elements in the jQuery collection.

The append () and appendTo () methods are used to perform the same task. The only difference between them is in the syntax.

Syntax:

Parameters of jQuery append() method

Parameter Description
Content It is a mandatory parameter. It specifies the content which you want to insert. Its possible values are:
  • HTML elements
  • jQuery objects
  • DOM elements
Function (index,html) It is an optional parameter. It specifies the function that returns the content to insert.
  • Index: It returns the index position of the element in the set.
  • HTML: It returns the current HTML of the selected element.

Example of jQuery append() method

Let’s take an example to demonstrate the jQuery append() method.

Test it Now

Next TopicjQuery appendto()

You may also like