What is the use of append() method in JQuery ? Last Updated : 02 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to see how to use the append() method in jQuery. The append() method is used to insert new content inside an existing element. There are some other methods also that provide to insert new content inside an existing element and these are - prepend(), html(), text(), before(), after(), wrap(), etc. Now, let's try to understand the append() method in detail. This method is used to insert content to the end of the selected elements. Syntax: $(selector).append(content, function(index, html)) Parameters: content: It is a mandatory parameter that specifies the content that you want to insert. It can contain mainly 3 types of possible values and these are:HTML valuesjQuery objectsDOM valuesfunction(index, HTML): It is an optional parameter that specifies the function that takes two parameters index and HTML that returns the contents that you want to insert.index: This parameter specifies the index position of the element in the set.HTML: This parameter specifies the current HTML of the selected element. Example: In this example, we will see the use of the append() method. HTML <!DOCTYPE html> <html> <head> <title> What is the use of append() method in JQuery? </title> <script src=" https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function() { $("#btn").click(function() { $('div').append(' GeeksforGeeks') }) }); </script> </head> <body style="text-align: center;"> <h1 style="color: green;">GeeksforGeeks</h1> <h2> What is the use of append() method in jQuery? </h2> <div>Welcome to</div> <br> <button id="btn">Append Text</button> </body> </html> Output: Comment More infoAdvertise with us Next Article What is the use of append() method in JQuery ? A AnujMehla Follow Improve Article Tags : Web Technologies JQuery Blogathon Blogathon-2021 jQuery-Methods HTML-Questions jQuery-Questions +3 More Similar Reads What is the use of delegate() method in jQuery ? jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms, simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax inte 2 min read What is the use of html() method in jQuery ? The html() method in jQuery is used to get the contents of the first element in the set of matched elements or is used to set the HTML contents of every matched element. It returns the content of the first matched element. This function does not accept any arguments. Syntax: $(selector).html();Appro 4 min read What is the use of param() method in jQuery ? In this article, we will learn about the param() method which is an inbuilt method provided by jQuery. This method is used for creating a serialized representation of an object. The method will recursively serialize deep objects for trying to work with modern languages like Ruby on Rails or Python. 3 min read What is the use of .each() function in jQuery ? The each() function in jQuery iterate through both objects and arrays. Arrays that have length property are traversed from the index 0 to length-1 and whereas arrays like objects are traversed via their properties names. Syntax: $.each('array or object', function(index, value){ // Your code }) In th 2 min read What is the equivalent method of document.createElement() in jQuery ? jQuery is a popular JavaScript library that simplifies the process of manipulating HTML elements and creating dynamic web pages. In jQuery, there are several ways to create new HTML elements dynamically. One of the common ways is to use the $() method to create new elements, but there is also a meth 3 min read Like