JSFiddle - React, Tailwind, and code Playground

HTML

<div class="dynamic-form">
<form>
<div class="inputs">
</div>
    <a href="#" id="add">ADD</a>
<input name="submit" type="button" class="submit" value="Submit">
</form>
</div>

JavaScript

$(document).ready(function(){

    var i = 1;
     
    $('#add').click(function() {
        $('<div id="d' + i + '" class="fielddiv"><input type="text" class="field" name="dynamic[]" value="' + i + '" /><a href="#" class="remove_question">Cancella</a><hr></div>').fadeIn('slow').appendTo('.inputs');
        i++;
    });
     
    $(document).on("click", ".remove_question", function(event) {
        alert('dsfsfd');
        //$('#d' + $this.attr('todel')).remove();
    });
     
     
    // here's our click function for when the forms submitted
 
    $('.submit').click(function(){
                                 
    var answers = [];
    $.each($('.field'), function() {
        answers.push($(this).val());
    });
     
    if(answers.length == 0) {
        answers = "none";
    }  
 
    alert(answers);
     
    return false;
                                 
    });
     
 
});