JSFiddle - React, Tailwind, and code Playground
HTML
<img src = "images/home.gif" />
<div class="chapter">
<p>Put an image after this line.</p>
<p>Put an image after this line.</p>
<p id="here" style='Background:red'>Put an image after this line.</p>
<p>Put an image after this line.</p></div>
<input id="Submit1" value="insert after paragaraph" type="submit"><br/><br/>
<input id="Submit2" value="insert eevry paragraph" type="submit"><br/><br/>
<input id="Submit3" value="insert before here" type="submit"><br/><br/>
<input id="Submit4" value="insert before here and hide" type="submit"><br/><br/>
<input id="Submit5" value="insert before div" type="submit"><br/><br/>
JavaScript
$("#Submit1").click(function () {
$("img").clone().insertAfter("p");
});
$("#Submit2").click(function () {
$("img").clone(true).insertAfter("p");
});
$("#Submit3").click(function () {
$("img").clone().insertBefore("#here");
});
$("#Submit4").click(function () {
$('img ').clone().insertBefore('#here').end().hide();
});
$("#Submit5").click(function () {
$('div.chapter p:eq(2)').clone().insertBefore('img');
});