JSFiddle - React, Tailwind, and code Playground

by Timmy Willison

HTML

<form action="#" method="post">
    <table id="items">
        <tr>
            <th>Item</th>
            <td><input type="text" name="item_0" value="item_0"></td>
        </tr>
    </table>
    <input type="button" id="newItem" value="Add Item">
</form>

JavaScript

var tr = $('#items tr').clone();

console.log( tr[0] );
tr.find('input')
    .attr({
        name: 'different',
        value: 'different'
    })
    .css('background-color', 'red')
    .end()
    .appendTo('#items');
console.log( tr[0] );