JSFiddle - React, Tailwind, and code Playground

by aslancods

HTML

<div id="ent">
    <input id="inp" onclick="clicker()">
</div>

JavaScript

function clicker(iden) {  
    iden = (!iden) ?  '' : iden;
    
    console.log(iden)
    
    var ent = document.getElementById('ent'+ iden ).cloneNode(true);
    iden++;
    ent.id = "ent" + iden;
    
    var input = ent.childNodes[1];
    input.id = "inp" + iden;
    
    input.onclick = function () {
        clicker(iden);
    };
    
    document.body.appendChild(ent);
}