File tree 1 file changed +20
-4
lines changed
1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 93
93
94
94
// stop append HTML if maximum limit exceed
95
95
if ( settings . maxLimit != 0 && item_exists >= settings . maxLimit ) {
96
- alert ( 'You cannot exceed more then ' + settings . maxLimit + ' item(s).' ) ;
96
+ alert ( "More than " + settings . maxLimit + " degrees can\'t be added in one form. Please 'Add New'." ) ;
97
97
return false ;
98
98
}
99
99
235
235
$ ( this ) . remove ( ) ;
236
236
} ) ;
237
237
238
+ if ( $template . find ( '.select2-container' ) . length > 0 ) {
239
+ $template . find ( '.select2-container' ) . each ( function ( ) {
240
+ $ ( this ) . remove ( ) ;
241
+ } ) ;
242
+ }
243
+
238
244
$template . find ( '.select2-container' ) . remove ( ) ;
239
245
240
246
//Remove Elements with excludeHTML
261
267
262
268
var _initializePlugins = function ( ) {
263
269
/* Initialize again chosen dropdown after render HTML */
264
- $ ( '.chosen-init' ) . each ( function ( ) {
265
- $ ( this ) . chosen ( ) . trigger ( 'chosen:update' ) ;
266
- } ) ;
270
+ if ( $ ( '.chosen-init' ) . length > 0 ) {
271
+ $ ( '.chosen-init' ) . each ( function ( ) {
272
+ $ ( this ) . chosen ( ) . trigger ( 'chosen:update' ) ;
273
+ } ) ;
274
+ }
275
+
276
+ if ( $ ( '.select2' ) . length > 0 ) {
277
+ $ ( '.select2' ) . each ( function ( ) {
278
+ $ ( this ) . select2 ( { width : '100%' } ) . trigger ( 'select2:update' ) ;
279
+ } ) ;
280
+ }
267
281
268
282
if ( $ . fn . datepicker && $ ( '.datepicker-init' ) . length > 0 ) {
269
283
$ ( '.datepicker-init' ) . datepicker ( { autoclose : true } ) ;
313
327
$elem . parents ( '.' + settings . cloneContainer ) . slideUp ( function ( ) {
314
328
$ ( this ) . remove ( ) ;
315
329
_updateAttributes ( ) ;
330
+ settings . afterRemove . call ( this ) ;
316
331
//_initializePlugins();
317
332
} ) ;
318
333
}
328
343
329
344
330
345
$ ( document ) . on ( 'click' , '.' + settings . removeButtonClass , function ( ) {
346
+ settings . beforeRemove . call ( this ) ;
331
347
_deleteItem ( $ ( this ) ) ;
332
348
} ) ;
333
349
You can’t perform that action at this time.
0 commit comments