File tree 1 file changed +5
-3
lines changed 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 92
92
var item_exists = $ ( '.' + settings . cloneContainer ) . length ;
93
93
94
94
// stop append HTML if maximum limit exceed
95
- if ( item_exists >= settings . maxLimit ) {
95
+ if ( settings . maxLimit != 0 && item_exists >= settings . maxLimit ) {
96
96
alert ( 'You cannot exceed more then ' + settings . maxLimit + ' item(s).' ) ;
97
97
return false ;
98
98
}
141
141
var newID = id ;
142
142
143
143
if ( id !== undefined ) {
144
- newID = incrementLastNumber ( id , index ) ;
144
+ newID = _incrementLastNumber ( id , index ) ;
145
145
$elem . attr ( 'id' , newID ) ;
146
146
}
147
147
156
156
return newID ;
157
157
}
158
158
159
- var incrementLastNumber = function ( string , index ) {
159
+ var _incrementLastNumber = function ( string , index ) {
160
160
return string . replace ( / [ 0 - 9 ] + (? ! .* [ 0 - 9 ] ) / , function ( match ) {
161
161
return index ;
162
162
} ) ;
317
317
} ) ;
318
318
}
319
319
}
320
+ } else {
321
+ alert ( 'you must have at least one item.' ) ;
320
322
}
321
323
} ;
322
324
You can’t perform that action at this time.
0 commit comments