JSFiddle - React, Tailwind, and code Playground
by 3gwebtrain
HTML
<div id="content">
</div>
<a href="#">Add Element</a>
CSS
#content{
border:2px dashed gray;
}
JavaScript
$("a").on("click", function (e) {
e.preventDefault();
var newAssociates = $("#content").find(":input:text");
var emptyAssociates = newAssociates.filter(function (index) {
return $.trim(this.value) === "";
});
if (!emptyAssociates.length) {
$("#content").append($("<input />"));
}
// first empty element should be focused..
emptyAssociates.first().focus();
});