Skip to content

Commit

Permalink
Minimum limit alert issue resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
rajneeshgautam authored Feb 28, 2020
1 parent 3963d56 commit ecc56c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cloneData.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
var item_exists = $('.' + settings.cloneContainer).length;

// stop append HTML if maximum limit exceed
if (item_exists >= settings.maxLimit){
if (settings.maxLimit != 0 && item_exists >= settings.maxLimit){
alert('You cannot exceed more then '+ settings.maxLimit +' item(s).');
return false;
}
Expand Down Expand Up @@ -141,7 +141,7 @@
var newID = id;

if (id !== undefined) {
newID = incrementLastNumber(id, index);
newID = _incrementLastNumber(id, index);
$elem.attr( 'id', newID);
}

Expand All @@ -156,7 +156,7 @@
return newID;
}

var incrementLastNumber = function (string, index) {
var _incrementLastNumber = function (string, index) {
return string.replace(/[0-9]+(?!.*[0-9])/, function(match) {
return index;
});
Expand Down Expand Up @@ -317,6 +317,8 @@
});
}
}
}else{
alert('you must have at least one item.');
}
};

Expand Down

0 comments on commit ecc56c3

Please sign in to comment.