JSFiddle - React, Tailwind, and code Playground

by Cwalkdawg

HTML

<div class="play">
  <div>
    <p>Item to be inserted after this p tag</p>
  </div>
</div>
<div class="play">
  <div>
    <p>Item to be inserted after this p tag</p>
  </div>
</div>
<div class="play">
  <div>
    <p>Item to be inserted after this p tag</p>
  </div>
</div>
<div class="play">
  <div>
    <p>Item to be inserted after this p tag</p>
  </div>
</div>

JavaScript

function appendPlay(index, content) {
    $('.play').eq(index).find('p').after(content);        
}

appendPlay(2, '<p>HTML to be inserted</p>');