JSFiddle - React, Tailwind, and code Playground

by chiragraninga

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css">
<table>
    <tr>
        <td>
            <input type="text" id="txtTitle" name="txtTitle">
        </td>
        <td>
            <input type="text" id="txtLink" name="txtLink">
        </td>
    </tr>
</table>
<button>Add Row</button>

JavaScript

$(document).ready(function () {
    $('input[id=txtTitle]').datepicker();
    
    var i = 1;
    $("button").click(function () {
        $("table tr:first").clone().find("input").each(function () {
            $(this).prop({
                'id': function (_, id) {
                    return id + i
                },
                    'name': function (_, name) {
                    return name + i
                },
                    'value': ''
            });
        }).end().appendTo("table");
        i++;
        
        $('input[id^=txtTitle]').removeClass('hasDatepicker');
        
        $('input[id^=txtTitle]').datepicker();
        
    });
});