New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mask not respected on Android #203
Comments
I'm also having this issue! |
I'm having a similar issue. When I type anything in an input using Android, nothing happens (it behaves like an ordinary input). When I blur it and then focus it again, the mask is suddenly applied to the current input (but won't be applied as I continue typing). Model: Samsung Galaxy S4 |
@amylashley @gutomotta since we got no solution for this, I've switched to this lib https://github.com/igorescobar/jQuery-Mask-Plugin it has a very similar syntax and it works great both on desktop/notebooks and mobile devices. Hope it helps! |
Try to replace keydownevent function with this one, sometimes keypress is not fired in the devices.
|
I tried to overwrite the keydownEvent() but it's not working yet (it behaves quite fuzzy, indeed). |
Hi, Also have same problem with... Chrome 53.0.2785.124 or Internet 4.0.20-20 The https://github.com/BankFacil/vanilla-masker run correct, but don't have support to negative numbers and HTML5 data attributes. Thanks |
I was able to solve it with this. It mimics the keypress function and I placed it right before the keydown function.
|
This solution worked! |
@aureliosaraiva can you help us with this? |
Tanks @gbvaz Works pretty good for me! |
@ggwebdev I'm glad I could help :) |
Thanks! This worked for me too! |
Other very simple workaround on this is just to set your input type as |
FYI @abdulmhamid's solution requires you to update the source file. You can add the snippet on line 489: https://github.com/plentz/jquery-maskmoney/blob/master/src/jquery.maskMoney.js#L489 |
I had issues with @abdulmhamid's code on browsers that weren't Chrome on Android. A solution is to make the code only run on Chrome browsers for Android devices: var ua = navigator.userAgent;
var isAndroid = /Android/i.test(ua);
var isChrome = /Chrome/i.test(ua);
// Fix masking on Chrome for mobile devices
if (isAndroid && isChrome) {
$input.on('keyup', function(e) {
e = e || window.event;
var key = e.which || e.charCode || e.keyCode,
keyPressedChar,
selection,
startPos,
endPos,
value;
selection = getInputSelection();
startPos = selection.start;
maskAndPosition(startPos + 1);
});
} |
Thanks @dspacejs ! This worked for me. |
I had too many HTML forms, so appyling @evsar3 solution via JQuery worked for me.
|
Working here! Thanks |
filipevl - agradeço resolveu meu problema |
Hi, I've been using this lib for quite a while now, it's pretty good, thank you for sharing it!
Recently I've noticed an odd behavior. On Android (that I know, 5.1 and lower ones), using Chrome (51.0.2704.81 and possibly other ones too), when I start typing numbers, say 1234 for example, in the field, I always get something like this $ 0.001234. Then, when I leave the field (blur), into another field it keeps the same $ 0.001234, but when I go back to it (focus), all of the sudden the mask is correctly applied $ 12.34.
Do you happen to have any Android device in order to simulate this situation? You can do so trying out the lib example page itself
Any help is appreciated!
Best wishes,
Guilherme Vaz
The text was updated successfully, but these errors were encountered: