JSFiddle - React, Tailwind, and code Playground
by turiyag
HTML
<html>
<head>
<title></title>
</head>
<body>
<form action="" method="post" name="myForm" accept-charset="utf-8">
<input type="text" />
<button id="clonetextinput">Create Input</button>
<button id="resetform">Reset Form</button>
</form>
</body>
</html>
CSS
input, button {
display: block;
margin: 20px;
padding: 5px;
}
JavaScript
var iInputsCount = 0;
$(function () {
$("#clonetextinput").click(function (event) {
iInputsCount++;
$('form').append('<input type="text" value="Input #' + iInputsCount + '" />');
event.preventDefault();
});
$("#resetform").click(function(event) {
$("form")[0].reset();
event.preventDefault();
});
});