JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/south-street/jquery-ui.css">
<button id="btn">Add <input id="count" type="text" size="2"/> element</button>
<div id="container"></div>
JavaScript
$("button").button();
$("#count").val("1").click(function(e) { e.preventDefault(); e.stopPropagation(); });
$("#btn").click(function(e) {
if ($("#count").val()) {
for (var i=0; i<$("#count").val(); i++) {
$("<p>element</p>").appendTo($("#container"));
}
$("#count").val("1");
} else {
$("<p>element</p>").appendTo($("#container"));
}
});