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><a id="focus"> (click here to focus the input)</a>
<div id="container"></div>

JavaScript

$("button").button();

$("#count").val("1");
$("#focus").click(function(){$("#count").focus()});

$("#btn").click(function() {
    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"));
    }
});