JSFiddle - React, Tailwind, and code Playground
by Dineshkani
HTML
<div id="firstdiv" class="sample">
<div>Hello Jquery</div>
</div>
<div id="secondiv" class="sample">
<div>Hello Jquery</div>
</div>
<input type="button" value="replaceWith" />
<input type="button" value="replaceAll" />
CSS
.sample{
background-color: white;
height: 140px;
}
JavaScript
$("input[value='replaceAll']").click(function(){
$("<h1>Replaced</h1>").replaceAll("#firstdiv");
});
$("input[value='replaceWith']").click(function(){
$("#secondiv").replaceWith("<h1>Replaced</h1>");
});