In this article, we will explain to you how to change text inside an element using jQuery. so we will give you a simple example of how to change text inside an element using jQuery.

Example: jQuery text() Method
In this example, we use the jQuery text() method to change text inside an element. so you can follow the below example.

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").text("Yellow");
  });
});
</script>
</head>
<body>

<button>Change text inside an element</button>

<p>Red</p>
<p>Green</p>

</body>
</html>