I have the following jquery that works fine on desktop browsers when I download it on Android chrome mobile, and when I start typing, the second letter goes before the first letter and the others follow the second letter.
Here's how it works ...
Can someone help me solve this problem?
$("#textbox").on('input', function(evt) {
if(this.lengh == 0) return $(this);
var input = $(this);
var start = input[0].selectionStart;
$(this).val($(this).val().replace(/[^a-zA-Z0-9 +:%=\\/-]/gi,""))
$(this).val(function (_, val) {
return val.toUpperCase();
});
input[0].selectionStart = input[0].selectionEnd = start;
});
source
share