Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery text()</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function() { $("#button").click(function() { $("p").text("India is Great!") }); }); </script> </head> <body> <button style="margin:0 0 10px 0;background:#e8e8e8;" class="btn" id="button">Change content of p element</button><br /> <p>This is a paragraph.</p> </body> </html>