JSFiddle - React, Tailwind, and code Playground
by Karan1412
HTML
<html>
<head>
<title>replaceAll</title>
</head>
<body>
<b>This content will replace all paragraph element's content on click of Replace All button.</b>
<p>This is 99codingexamples.</p><br />
<p>This is demo for replaceAll method.</p><br />
<p>Jquery is amazing.</p><br />
<input type="button" id="replaceAll" value="Replace All"/>
<input type="button" id="replaceWith" value="Replace With"/>
<input type="button" id="reset" value="Reset" onclick="location.reload()" />
</body>
</html>
JavaScript
$(document).ready(function () {
$("#replaceAll").click(function () {
$("b").replaceAll("p");
});
$("#replaceWith").click(function () {
$("p").replaceWith($('b'));
});
});