JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="//cdn.jsdelivr.net/select2/3.5.2/select2.css">
<script src="//cdn.jsdelivr.net/select2/3.5.2/select2.min.js"></script>
<table width="100%">
<tbody>
<tr>
<th>Flavor Brand</th>
<th>Flavor Name</th>
<th>Dropper type</th>
<th>Quantity Unit</th>
<th>Quantity</th>
<th>Add/Remove row</th>
</tr>
<tr class="flavors">
<td>[brand_list]</td>
<td>
<select id="arome0" class="select2-select"></select>
</td>
<td>
<select id="dropper0" class="select2-select">
<option selected="selected" value="type1">type 1</option>
<option value="type2">type 2-3</option>
</select>
</td>
<td>
<select id="qtyunit0" class="select2-select">
<option value="ml">ml</option>
<option value="drops">drops</option>
<option selected="selected" value="perc">%</option>
</select>
</td>
<td>
<input id="quantity0" class="quantity" type="number" />
</td>
<td>
<button type="button" class="addline">Add Line</button>
<button type="button" class="remline">Remove Line</button>
</td>
</tr>
</tbody>
</table>
JavaScript
$(document).on('click', '.addline', function () {
var $tr = $(this).closest('tr');
var $lastTr = $tr.closest('table').find('tr:last');
$lastTr.find('.select2-select').select2('destroy');
var $clone = $lastTr.clone();
$clone.find('td').each(function() {
var el = $(this).find(':first-child');
var id = el.attr('id') || null;
if (id) {
var i = id.substr(id.length - 1);
var prefix = id.substr(0, (id.length - 1));
el.attr('id', prefix + (+i + 1));
el.attr('name', prefix + (+i + 1));
}
});
$tr.closest('tbody').append($clone);
$lastTr.find('.select2-select').select2();
$clone.find('.select2-select').select2();
});
$('.select2-select').select2();