you can use replace(´oldchars´,´newchars´) method in jquery. First get the text of that paragraph tag and replace the respective string and then set back the new text into it. If you want to replace only one word with only one occurrence in the text you can simply call replace("Old Word","New Word"). and if there is more than one occurrences or you want to replace all the words by new one then use regular expression in place of old word in replace method. See the below code snippet:
replace.html:
-----------------------------------------
<html>
<head>
<title>Replace in jquery-anyforum.in</title>
</head>
<body>
<p id="content">Hi, How are you? Hi, I am fine.</p>
<button id="button">Click here to replace</button>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(´button´).click(function(){
//$(´#content´).text($(´#content´).text().replace(´Hi´,´Bye´));//replaces only first occurrence
$(´#content´).text($(´#content´).text().replace(/\bHi\b/gi,´Bye´));
});
</script>
</body>
</html>
Output:
------------------------------
Hi, How are you? Hi, I am fine.
Click here to replace