Change the content of an Element using jquery

In this example, when we click on the Button the Content of the Paragraphs will be C# corner.

<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("p").html("C# corner");
  });
});
</script>
</head>

<body>

<p>My Name is Mahak</p>
<p>I Love ASP.NET</p>
<button>Change</button>
</body>
</html>


Output:

1.png

When we click on the Change Button the output will be:


2.png
Ebook Download
View all
Learn
View all