Skip to content

Commit 559acfe

Browse files
author
Jon Dunlap
committed
Fix input bug for Samsung keyboards
1 parent bb66bf9 commit 559acfe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/jquery.maskedinput.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ $.fn.extend({
201201
function androidInputEvent(e) {
202202
var curVal = input.val();
203203
var pos = input.caret();
204+
var proxy = function() {
205+
$.proxy($.fn.caret, input, pos.begin, pos.begin)();
206+
};
204207
if (oldVal && oldVal.length && oldVal.length > curVal.length ) {
205208
// a deletion or backspace happened
206209
checkVal(true);
@@ -211,7 +214,7 @@ $.fn.extend({
211214
while (pos.begin < firstNonMaskPos && !tests[pos.begin])
212215
pos.begin++;
213216
}
214-
input.caret(pos.begin,pos.begin);
217+
setTimout(proxy, 0);
215218
} else {
216219
var pos2 = checkVal(true);
217220
var lastEnteredValue = curVal.charAt(pos.begin);
@@ -227,7 +230,7 @@ $.fn.extend({
227230
}
228231
}
229232
}
230-
input.caret(pos.begin,pos.begin);
233+
setTimeout(proxy, 0);
231234
}
232235
tryFireCompleted();
233236
}

0 commit comments

Comments
 (0)