JSFiddle - React, Tailwind, and code Playground
by vikrant singh
HTML
<table>
<thead>
<tr>
<th class="text-center">Amount</th>
<th class="text-center">Installment</th>
<th class="text-center">Source of Money</th>
</tr>
</thead>
<tbody>
<tr class="row1" id="rw1">
<td class="text-center" id="rw1cl1">
<input class="form-control" type="text">
</td>
<td class="text-center" id="rw1cl2">
<input class="form-control" type="text">
</td>
<td class="text-center" id="rw1cl3">
<input class="form-control" type="text" id="sm">
</td>
</tr>
</tbody>
</table>
JavaScript
$(document).ready(function () {
$('#sm').on('keyup', function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13) {
var cloned = $('.row1').first().clone(true);
cloned.insertAfter("#rw1").find("input").val("");
}
});
});