From 261fc0d4a34ee499729c368830e1d6a6b92bd39f Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Mon, 9 Dec 2024 22:34:32 +0000 Subject: [PATCH] fix: clone count --- js/clone.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/clone.js b/js/clone.js index 72aab6db..52bc1067 100644 --- a/js/clone.js +++ b/js/clone.js @@ -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 ) { @@ -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 );