Open In App
Related Articles

How to insert a jQuery object after all paragraphs using jQuery ?

Improve Article
Save Article
Like Article

The task is to insert a jQuery object after all the paragraphs using jQuery.


  • Create DOM element or jQuery object using <span> tag.
  • Create a paragraph using <p> tag.
  • Create a button using button tag after clicking on which the object will be inserted after paragraph.
  • Write a script that will call a function jQuery.after()  which is used to insert a jQuery object after all the paragraphs.

Example: Below is the working code using the above-mentioned steps.


  <script src=
  <h1 style="color:green"
     Dom element / jQuery object
     This is paragraph
  <button id="GFG_button1" style="display: block;
     margin-top: 15px;">
     Click here to insert object after paragraph
      $('#GFG_button1').click(function () {


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 22 May, 2021
Like Article
Save Article
Similar Reads
Related Tutorials