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.


$(selector).append(content, function(index, html))

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.

<!DOCTYPE html>
<script src=""></script>
        $("p").append(" <b>Newly added appended text</b>.");
        $("ol").append("<li><b>Newly added appended item</b></li>");
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
  <li>Item no.1</li>
  <li>Item no.2</li>
  <li>Item no.3</li>
<button id="btn1">Append text</button>
<button id="btn2">Append item</button>
Related Tutorial
Follow Us #
Contents +