diff --git a/source/assets/javascripts/locastyle/_duplicate_form.js b/source/assets/javascripts/locastyle/_duplicate_form.js index 7db0b734..94af1c1d 100644 --- a/source/assets/javascripts/locastyle/_duplicate_form.js +++ b/source/assets/javascripts/locastyle/_duplicate_form.js @@ -26,14 +26,21 @@ Locastyle.prototype.duplicateForm = (function() { $(config.actions.duplicate).on('click', function(el) { el.preventDefault(); var cloneLast = $(config.selectors.form).last().clone(); + cloneLast.appendTo(config.selectors.parent); + $(config.selectors.form).last().find('input').first().focus(); + cleanLastRow(); addValueToDataForm(); verifyFormNumbers(); removeForm(); }); } + function cleanLastRow() { + $(config.selectors.form).last().find('input, select, textarea').val(''); + } + function addValueToDataForm() { $(config.selectors.form).each(function(i, el) { $(el).attr('data-form', i);