JSFiddle - React, Tailwind, and code Playground

by chauhangs

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<input type="button" id="addmore" value="Add More" onclick="insertRow()" />
<br/>
<br/>
<table id="ttable" border="1">
    <tr>
        <td>1</td>
        <td>Name :
            <input size=25 type="text" id="testId" />
        </td>
    </tr>
</table>

JavaScript

function insertRow() {
    var x = document.getElementById('ttable');
    var new_row = x.rows[0].cloneNode(true);
    var len = x.rows.length;
    new_row.cells[0].innerHTML = len;

    var inp1 = new_row.cells[1].getElementsByTagName('input')[0];
    inp1.id += len;
    inp1.value = '';
    x.appendChild(new_row);
}