JSFiddle - React, Tailwind, and code Playground
HTML
<p>Milho
<input type="checkbox" class="check">
</p>
<p>Sorgo
<input type="checkbox" class="check">
</p>
<p>Monenzina
<input type="checkbox" class="check">
</p>
<p>Calcário Calcítico
<input type="checkbox" class="check">
</p>
<p>Farelo de Soja
<input type="checkbox" class="check">
</p>
<p>Farelo de Algodão
<input type="checkbox" class="check">
</p>
<p>Aromatizante
<input type="checkbox" class="check">
</p>
<p>Farelo de Arroz
<input type="checkbox" class="check">
</p>
<button id="add-button" type="submit">Adicionar</button>
<div id="receiver">
<form id="form-receiver">
<fieldset></fieldset>
</form>
</div>
JavaScript
function camelCase(input) {
return input.toLowerCase().replace(/[-\s](.)/g, function (match, group1) {
return group1.toUpperCase();
});
}
$('#add-button').click(function () {
$('.check').each(function () {
if (this.checked) {
var nome = $(this).parent().text();
if (!$('#form-receiver').find("input[name='" + camelCase(nome) + "']").length) {
$('#form-receiver fieldset').append("<p>" + nome + "<input name='" + camelCase(nome) + "'></p>")
}
}
})
});