JSFiddle - React, Tailwind, and code Playground
HTML
<a href="#">add</a>
<div id="box"></div>
JavaScript
$(function () {
var counter = 0;
$('a').click(function () {
var elems = '<div>'+
'<input type="text" id="t1"' + (counter) + '"/>' +
'<input type="text" id="t1"' + (counter) + '"/>' +<br>
'<input type="button" class="removebtn" value="Remove" id="removebtn"' + (counter) + '"/>' +
'</div>';
$('#box').append(elems);
counter++;
return false;
});
$('.removebtn').live('click',function () {
$(this).parent().remove();
});
});