|
13 | 13 | |-------------------------------------------------------------------
|
14 | 14 | */
|
15 | 15 |
|
16 |
| -; |
17 | 16 | (function($) {
|
18 | 17 |
|
19 | 18 | $.fn.metalClone = function(options, callback) {
|
|
53 | 52 | nodeType = base[0].nodeName,
|
54 | 53 | // Capture the configuration options
|
55 | 54 | currentCopyValue = opt.copyValue,
|
| 55 | + currentClearExceptions = opt.clearExceptions, |
56 | 56 | currentPosition = opt.position,
|
57 | 57 | currentNumberToClone = opt.numberToClone,
|
58 | 58 | currentDestination = opt.destination,
|
|
374 | 374 | clearForm(toClone);
|
375 | 375 | }
|
376 | 376 |
|
377 |
| - clonedElement.push(toClone); |
378 |
| - |
379 | 377 | (function (index) {
|
380 | 378 | if (enableScrollTop) {
|
381 | 379 | if (index == 1 && currentIteration == (length - 1)) {
|
|
409 | 407 | clearForm(toClone);
|
410 | 408 | }
|
411 | 409 |
|
412 |
| - clonedElement.push(toClone); |
413 | 410 | }
|
| 411 | + |
| 412 | + clonedElement.push(toClone); |
414 | 413 | }
|
415 | 414 | }
|
416 | 415 | // not table element and destination not table element
|
|
588 | 587 | clearForm(toClone);
|
589 | 588 | }
|
590 | 589 |
|
591 |
| - clonedElement.push(toClone); |
592 |
| - |
593 | 590 | (function (index) {
|
594 | 591 | if (enableScrollTop) {
|
595 | 592 | if (index == 1 && currentIteration == (length - 1)) {
|
|
622 | 619 | clearForm(toClone);
|
623 | 620 | }
|
624 | 621 |
|
625 |
| - clonedElement.push(toClone); |
626 | 622 | }
|
| 623 | + |
| 624 | + clonedElement.push(toClone); |
627 | 625 | }
|
628 | 626 | }
|
629 | 627 |
|
|
711 | 709 | function clearForm(container) {
|
712 | 710 |
|
713 | 711 | 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(''); |
715 | 713 | });
|
716 | 714 | }
|
717 | 715 |
|
|
1032 | 1030 |
|
1033 | 1031 | btnClone: null, // Put your selector(button class or id name) eg : .clickMe | #clickMe
|
1034 | 1032 | 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' |
1035 | 1034 | btnRemoveText: 'Remove', // Text appear on remove button
|
1036 | 1035 | btnRemoveClass: null, // Adding user defined class name for remove button
|
1037 | 1036 | btnCloneText: 'Create New Element', // Text appear on clone button
|
|
0 commit comments