JSFiddle - React, Tailwind, and code Playground

by jnfsmile

HTML

<p id="a">Hello You</p>
<hr>
<p id="b">Hello Me</p>

CSS

.color{
    color: red;
}
.color2 {
    color: blue;
}

JavaScript

$(function(){
    //.after() returns the original element for chaining
    $("#a").after("<p>Bye You</p>").addClass("color");
    
    //.insertAfter() returns the new element for chaining
    $("<p>Bye Me</p>").insertAfter("#b").addClass("color2");
});