JSFiddle - React, Tailwind, and code Playground
by Dineshkani
HTML
<div id="firstdiv" class="sample">
<span name="jQuery"> Hello Jquery </span>
</div>
<br/><br/><br/><br/><br/>
<div id="seconddiv" class="sample">
<span name="jQuery"> Hello world </span>
</div>
<input type="button" value="before" />
<input type="button" value="insertbefore" />
CSS
.sample{
background-color: white;
height: 40px;
}
JavaScript
$("input[value='before']").click(function(){
$("#firstdiv").before("<h1>Hai</h1>");
});
$("input[value='insertbefore']").click(function(){
$('<h2>Hai</h2>').insertBefore("#seconddiv");
});