File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -146,10 +146,8 @@ you need is this JavaScript code:
146146 jQuery (document ).ready (function () {
147147 jQuery (' .add-another-collection-widget' ).click (function (e ) {
148148 var list = jQuery (jQuery (this ).attr (' data-list' ));
149- // Try to find the counter of the list
149+ // Try to find the counter of the list or use the length of the list
150150 var counter = list .data (' widget-counter' ) | list .children ().length ;
151- // If the counter does not exist, use the length of the list
152- if (! counter) { counter = list .children ().length ; }
153151
154152 // grab the prototype template
155153 var newWidget = list .attr (' data-prototype' );
@@ -160,7 +158,7 @@ you need is this JavaScript code:
160158 // Increase the counter
161159 counter++ ;
162160 // And store it, the length cannot be used if deleting widgets is allowed
163- list .data (' widget-counter' , counter);
161+ list .data (' widget-counter' , counter);
164162
165163 // create a new list element and add it to the list
166164 var newElem = jQuery (list .attr (' data-widget-tags' )).html (newWidget);
You can’t perform that action at this time.
0 commit comments