Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Merge pull request #36 from antoniojunyor/master
Browse files Browse the repository at this point in the history
Improvements on multiply form
  • Loading branch information
flaviomuniz committed Jan 28, 2015
2 parents eb2ab15 + 82ea2c4 commit 084d01b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/assets/javascripts/locastyle/_duplicate_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 084d01b

Please sign in to comment.