Skip to content
Related Articles

Related Articles

Improve Article

How to insert some HTML after all paragraphs using jQuery ?

  • Last Updated : 31 Dec, 2020

In this article, we will insert some HTML content after all paragraphs using jQuery. To add some content after all paragraph elements, we use the after() method. This method is used to insert the specified content after each selected element in the set of matched elements.


$( selector ).after( content );



  <!-- Import jQuery from CDN -->
  <script src=
    $(document).ready(function () {
      $("button").click(function () {
          '<p>Welcome to GFG</p>
          <input type="text">'
<body style="text-align: center;">
  <h1 style="color: green;">
    How to insert some HTML after
    all paragraphs using jQuery?
    GeeksforGeeks computer 
    science portal
  <button>Click Here!</button>


Before clicking the button:

After clicking the button:

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :