Skip to content

Commit a562c43

Browse files
committed
Merge branch 'dev'
2 parents 931d6c7 + 76b40c0 commit a562c43

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Simple plugin to clone HTML DOM element.
3636

3737
# Current Stable #
3838

39-
- [**V1.4.2**](https://github.com/metallurgical/jquery-metal-clone/archive/v1.4.2.zip "V1.4.2")
39+
- [**V1.4.3**](https://github.com/metallurgical/jquery-metal-clone/archive/v1.4.3.zip "V1.4.3")
4040

4141
# How To Install #
4242

jquery.metalClone.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
|-------------------------------------------------------------------
1414
*/
1515

16-
;
1716
(function($) {
1817

1918
$.fn.metalClone = function(options, callback) {
@@ -53,6 +52,7 @@
5352
nodeType = base[0].nodeName,
5453
// Capture the configuration options
5554
currentCopyValue = opt.copyValue,
55+
currentClearExceptions = opt.clearExceptions,
5656
currentPosition = opt.position,
5757
currentNumberToClone = opt.numberToClone,
5858
currentDestination = opt.destination,
@@ -374,8 +374,6 @@
374374
clearForm(toClone);
375375
}
376376

377-
clonedElement.push(toClone);
378-
379377
(function (index) {
380378
if (enableScrollTop) {
381379
if (index == 1 && currentIteration == (length - 1)) {
@@ -409,8 +407,9 @@
409407
clearForm(toClone);
410408
}
411409

412-
clonedElement.push(toClone);
413410
}
411+
412+
clonedElement.push(toClone);
414413
}
415414
}
416415
// not table element and destination not table element
@@ -588,8 +587,6 @@
588587
clearForm(toClone);
589588
}
590589

591-
clonedElement.push(toClone);
592-
593590
(function (index) {
594591
if (enableScrollTop) {
595592
if (index == 1 && currentIteration == (length - 1)) {
@@ -622,8 +619,9 @@
622619
clearForm(toClone);
623620
}
624621

625-
clonedElement.push(toClone);
626622
}
623+
624+
clonedElement.push(toClone);
627625
}
628626
}
629627

@@ -711,7 +709,7 @@
711709
function clearForm(container) {
712710

713711
container.find('input:not("input[type=button], input[type=submit], input[type=checkbox], input[type=radio]"), textarea, select').each(function() {
714-
$(this).val('');
712+
$ (this).not(currentClearExceptions).val('');
715713
});
716714
}
717715

@@ -1032,6 +1030,7 @@
10321030

10331031
btnClone: null, // Put your selector(button class or id name) eg : .clickMe | #clickMe
10341032
copyValue: false, // Clone together the previous element value - available for form element only
1033+
clearExceptions: '', // Make exception for elements that you do not want to clear: eg: '.my_exception_element, #my_exception_element'
10351034
btnRemoveText: 'Remove', // Text appear on remove button
10361035
btnRemoveClass: null, // Adding user defined class name for remove button
10371036
btnCloneText: 'Create New Element', // Text appear on clone button

0 commit comments

Comments
 (0)