JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<button id="add">
Add
</button>
<span class="content">
</span>
<span class="add-content">
</span>
JavaScript
$(document).on("change", ".input", function() {
if ($(this).val() > 0) {
$(".add-content").append(
'<input class="input" type="text" value="test" />'
)
}
})
$("#add").click(function(e) {
e.preventDefault();
$(".content").append(
'<input class="input" type="number" min="0" />'
)
})
$(document).on("change _change", ".input", function(e) {
if ($(this).val() > 0) {
$(".add-content").append(
'<input class="input" type="text" value="test" />'
)
}
})
$(".content").append(
'<input class="input" type="number" min="0" value="3"/>'
)
.find(".input:last").trigger("_change")