Home >>jQuery Tutorial >jQuery append() Method

jQuery append() Method

jQuery append() Method

jQuery append() method in jQuery is used to inserts specified content at the end of the selected elements.


Parameter Values

Parameter Description
content It is a Required parameter used to insert the specifies content (can contain HTML tags)

Possible values:

  • HTML elements
  • jQuery objects
  • DOM elements
function(index,html) It is used to returns the specifies content to insert
  • index – used to Returns the set of index position in the element
  • html – used to Returns the current HTML of the selected element
Here is an example of jQuery append() Method:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
$(".txt1").append(" <b>Append text</b>.");
$(".list").append("<li>Append item</li>");
<p class="txt1">Phptpoint</p>
<p class="txt1">learn here</p>
<ol class="list">
<li>List item 1</li>
<li>List item 2</li>
<button id="btn1">Append text</button>
<button id="btn2">Append list</button>



learn here

  1. List item 1
  2. List item 2

No Sidebar ads