Skip to content
Related Articles

Related Articles

How to append a jQuery object to all paragraphs using jQuery ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 23 Apr, 2021

In this article, we will see how to append a jQuery object to all paragraphs using jQuery. Append means we add something to an existing element. The object is used to define a container for an external resource like a page, a picture, a media player, or a plug-in application.

Used Methods:

  • ready() Method: This method is used to specify a function to execute when the DOM is fully loaded.
  • click() Method: This method is used to trigger the click event, or attaches a function to run when a click event occurs.
  • append() Method: This method is used to insert specified content at the end of the selected elements.


  • Create the HTML page with paragraph <p> elements.
  • Next, write a script to append the object into the paragraph element.



<!DOCTYPE html>
    <script src=
        body {
            text-align: center;
            font-size: 20px;
        button {
            background-color: #4CAF50;
            /* Green */
            border: none;
            color: white;
            padding: 15px 32px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
        object {
            font-size: 30px;
            color: lightgreen;
            background-color: green;
        $(document).ready(function () {
            $("button").click(function () {
                    "<object>This is object</object>.");
    <h2 style="color:green">GeeksforGeeks</h2>
        Click on the button to append object 
        at the end of every paragraph.
    <p>This is a paragraph.</p>
    <p>This is another paragraph.</p>
    <button>Append Object</button>


Append object

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!