JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <p>1</p>
</div>

<div>
    <p>1</p>
    <p>2</p>
    <p>3</p>
</div>

JavaScript

$(document).ready(function() {
    $("div").each(function() {
        var $this = $(this);
//        $this.find("p").add($("<p>")).eq(1).html("test").appendTo($this);
        $this.find("p").add($("<p>")).eq(1).html("test").insertAfter($this.find("p").eq(0));
    });
});