Skip to content
Related Articles

Related Articles

How to append some text to all paragraphs using jQuery ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 31 Dec, 2020

In this article, we will append some text to all paragraph elements using jQuery. To append some text to all paragraph elements, we use append() and document.createTextNode() methods.

jQuery append() method is used to insert some content at the end of the selected elements.


$(selector).append( content, function(index, html) )



<!DOCTYPE html>
<html lang="en">
    <!-- Import jQuery cdn library -->
    <script src=
        $(document).ready(function () {
            $("button").click(function () {
                .createTextNode(" GeeksforGeeks"));
<body style="text-align: center;">
    <h1 style="color: green;">
        How to append some text to
        all paragraphs using jQuery?
        Computer Science Portal
    <button>Click Here!</button>


Before Click the Button:

After Click Button:

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!