JSFiddle - React, Tailwind, and code Playground

HTML

<button id="addLevelBtn">Add a level</button>
<br>
<button id="getResultsBtn">Get results</button>

JavaScript

//on click, add a level
$('#addLevelBtn').on('click',addLevel);

//on click, get results
$('#getResultsBtn').on('click',getResults);

//add the first level on load
addLevel();


function addLevel(){
    var nbOfSets = $('.setOfInputs').length;
    $('#addLevelBtn').before(
        '<div class="setOfInputs" id="set-'+nbOfSets+'">'
        
            +'<p>#set-'+nbOfSets+'</p>'
        
            +'<label for="age">Age: </label>'
            +'<input type="text" name="age">'
        
            +'<label for="weight">Weight: </label>'
            +'<input type="text" name="weight">'
        
        +'</div>');
}

function getResults(){
    var result="";
    $.each($('.setOfInputs'),function(){
        var id = $(this).attr('id');
        var age = $(this).find('[name=age]').val();
        var weight = $(this).find('[name=weight]').val();
        result += id + ' : age = ' + age + ' , weight = ' + weight + '\n';
    });
    alert(result);
}