Hey thanks for posting your codes, it was helpful to find the exact reason why you are facing this problem.
this.keyup(function () {
var val = $(this).val();
if (val != "" || val != null) {
if (($.isArray(settings.replaceChar) && $.isArray(settings.replaceWith)) && (settings.replaceChar.length == settings.replaceWith.length)) {
for (var i = 0; i < settings.replaceChar.length; i++) {
val = val.replace(new RegExp(settings.replaceChar[i], "g"), settings.replaceWith[i]);
}
} else {
val = val.replace(new RegExp(settings.replaceChar, "gm"), settings.replaceWith);
}
}
$(this).val(val);
val = '';
In the above code of yours, you are making the val clear at the bottom
val = '';
which is correct but there is still a value in text box and that is single quote.
So once you put a single quote in your text box it converts single quote to two single quotes, till here code runs fine, but next time when you again put single quote now there are three single quotes in your text box.
As there are three single quotes present in textbox, as per your code it converts all three single quotes to six single quotes.
Please keep in mind that clearing textbox is not a solution.