Skip to content

Commit

Permalink
fix: clone count
Browse files Browse the repository at this point in the history
  • Loading branch information
tanftw committed Dec 9, 2024
1 parent 4d80c6b commit 261fc0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

// Clear fields' values.
var $inputs = $clone.find( rwmb.inputSelectors );
const count = $container.children( '.rwmb-clone' ).length;
let count = $container.children( '.rwmb-clone' ).length;

// The first clone should keep the default values.
if ( count > 1 ) {
Expand All @@ -162,6 +162,7 @@

// Insert clone.
$clone.insertAfter( $last );
count++;

// Trigger custom event for the clone instance. Required for Group extension to update sub fields.
$clone.trigger( 'clone_instance', nextIndex );
Expand Down

0 comments on commit 261fc0d

Please sign in to comment.