Append() Function Examples For Python, JavaScript, and jQuery – POFTUT

Append() Function Examples For Python, JavaScript, and jQuery

append() is a popular function or method used for Python, JavaScript, and jQuery. Append mainly used to add and append some items to the list or group of items.

Python List append() Function

Python provides the append() function for the list data type. The list is a data type used to store multiple items in a single data structure with a single variable. append() will add some items to this list.


  • LIST is the list object where we want to add a new item.
  • ITEM is the item we will add to the LIST.

Now we will create a list named “mycars” and add new items to this list object by using the append() method.

mycars = ['hyundai','ferrari']



Python List append() Function

JavaScript ParentNode.append() Function

JavaScript provides a different object in order to manipulate the DOM. There is an object named ParentNode which provides the append() function.


  • ParentNode is the DOM object we will add.
  • ITEM is the HTML orDOM item which will be added under the ParentNode.

In the following example we will create a div element and add “This text is added with append() function” as text inside this div element.

let p= document.createElement("div")

p.append("This text is added with append() function")

jQuery append() Function

jQuery is a popular JavaScript framework. jQuery provides the append() function in order to add an HTML element. It is very similar to the JavaScript ParentNode element append() function.

In the following example we will select the class named “container” and then add some text inside this class object.

$( ".container" ).append( "This text will be appended() under the class .container" );

LEARN MORE  strcat() Function Tutorial In C and C++ with Examples

Leave a Comment