JSFiddle - React, Tailwind, and code Playground
by popnoodles
HTML
<button>Clone it</button>
<div class="item-name">
<label for="id_form-0-name"></label>
<select id="id_form-0-name" name="form-0-name"></select>
</div>
JavaScript
$('button').on('click', function(){
var clone=$('.item-name:last').clone();
clone.insertAfter('.item-name:last');
var attrs='id_form-' + clone.index() + '-name';
clone.find('label').attr('for', attrs)
// clone.find('label').text(attrs); // uncomment this to see it's incrementing without inspecting element
clone.find('select').attr({id: attrs, name: attrs});
});