Open In App
Related Articles

How to append some text to all paragraphs using jQuery ?

Improve Article
Save Article
Like Article

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:

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 : 31 Dec, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials