JSFiddle - React, Tailwind, and code Playground

by Darby Rathbone

HTML

<button id='addform'>add form</button>
<button id='removeform'>remove first form</button>

CSS

form{
    outline:black 1px solid;
}

JavaScript

var forms = [];
document.getElementById('addform').addEventListener('click', function () {
    var form = document.createElement('form');
    var input = document.createElement('input');
    input.type = 'text';
    form.appendChild(input);
    document.body.appendChild(form);
    forms.push(form);
});

document.getElementById('removeform').addEventListener('click', function () {
    document.body.removeChild(forms.shift());
});