JSFiddle - React, Tailwind, and code Playground

by Annie Lagang

HTML

<button id="click">CLICK TO CLONE</button> 
  <div id="id">id</div>

JavaScript

var cloneCount = 1;;
   $("button").click(function(){
      $('#id')
          .clone()
          .attr('id', 'id'+ cloneCount++)
          .insertAfter($('[id^=id]:last'))
          .text('id ' + (cloneCount-1)); //<--For DEMO
   });