Skip to content

Commit

Permalink
Fix adding a group row duplicates the previous row's content, Fixes C…
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed May 5, 2015
1 parent d5eb094 commit 78ed4b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions js/cmb2.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ window.CMB2 = (function(window, document, $, undefined){
var $newInput = $(this);
var isEditor = $newInput.hasClass( 'wp-editor-area' );
var oldFor = $newInput.attr( 'for' );
var oldVal = $newInput.attr( 'value' );
// var $next = $newInput.next();
var attrs = {};
var newID, oldID;
Expand All @@ -361,6 +362,17 @@ window.CMB2 = (function(window, document, $, undefined){
// value: '',
'data-iterator': cmb.idNumber,
};

}

// Clear out old values
if ( undefined !== typeof( oldVal ) && oldVal ) {
attrs.value = '';
}

// Clear out textarea values
if ( 'TEXTAREA' === $newInput.prop('tagName') ) {
$newInput.html( '' );
}

$newInput
Expand Down
Loading

0 comments on commit 78ed4b5

Please sign in to comment.