jquery

Hello, welcome to therichpost.com. In this post, I will tell you How to change the text of p tag on button click with jquery? I personally like jquery very much. Most of my code is full with jquery. When I stuck in php or other language then that stuckness I remove with jquery code. Today i am going to start with simple jquery code to text change.

Here is the first image of text when button is not clicked:

Here is the first image of text after button click:

Here is the html code first:

<p>Click On Button</p>
<button id=”button”>Click!!</button>

Here is the jquery script to change the text on button click:

jQuery(“#button”).click(function(){
$(“p”).text(“Button Clicked!!”);
});

There are so many jquery code, tricks and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

By therichpost

Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

3 thoughts on “How to change the text of p tag on button click with jquery?”
  1. header(“Access-Control-Allow-Origin: *”);
    header(“Access-Control-Allow-Methods: PUT, GET, POST”);
    header(“Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept”);
    $conn = new mysqli(‘localhost’,’root’,’root’,’users’);
    $sql = “SELECT * FROM users_tbl”;
    $result = $conn->query($sql);
    $myArr = array();
    if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
    $myArr[] = $row;
    }
    } else {
    echo “0 results”;
    }

    $myJSON = json_encode($myArr);
    echo $myJSON;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.