JSFiddle - React, Tailwind, and code Playground

HTML

<html>
    <body>
        <!-- the template -->
        <script id="fieldTemplate" type="text/html">
            <div>
                <label>My Field:</label>
                <input type="text"/>
            </div>
        </script>
        
        <!-- new fields will be added here -->
        <div id="fieldsContainer"></div>
        
        <!-- button to add a new field -->
        <button type="button" id="addField">Add Field</button>
    </body>
</html>

JavaScript

function addField() {
    // get html from the template
    var html = $('#fieldTemplate').html();
    
    /*
        make a new dom element (need to trim whitespace or jquery 
        won't parse the template properly
        */
    var $newField = $($.trim(html));
    
    // insert the new field and make it a datepicker
    $('#fieldsContainer')
    .append($newField)
    .find('input')
    .datepicker();
}

$(function() {
    // bind event listener to button
    $('#addField').click(addField);
    
    // add one field to start
    addField();
});