Masked input is not working in android phones

12,370

Solution 1

I resolved this issue with three actions, which have fixed this for all Android 4.0+ phones:

  1. Update masked-input to at least version 1.4
  2. Add type="tel" to the input, to trigger the phone keypad
  3. Remove the input's maxlength attribute or set it to a value certain not to interfere with the caret action, like 20.

Solution 2

Quoting the original answer (in comment) by Jonathan Rowny on "masked input not working in android mobiles?":

This was fixed awhile ago (11 months ago) but for some reason the distribution posted on the website never took the changes. If you grab from the raw source, the fix works: https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/master/src/jquery.maskedinput.js

Share:
12,370
786543214
Author by

786543214

Updated on July 26, 2022

Comments

  • 786543214
    786543214 almost 2 years

    Hi I have used the masked input plugin click for my website to format the phone number which is entered by the user I am using the format as (123) 456-7890 its working fine with PC's but when I browse the site with android devices and enter the phone number as 1234567890 its order is getting changed as (213) 456-7890 or any random order automatically.

    You can see this issue in their demo site itself here is the link In the goto demo tab next to usage tab.

    can anyone suggest me a solution for the same.

  • PolGraphic
    PolGraphic almost 10 years
    The question is about "my code DOES work on PC but DOES NOT work on mobile". He is not asking about best mask formula, your don't answer the question.
  • Carlos Spohr
    Carlos Spohr about 8 years
    2015, abril, 13, yeah, it fixes my problem with a lot of mobile browsers.
  • Pablo S G Pacheco
    Pablo S G Pacheco almost 8 years
    It didn't help me. Actually it created other problems :(
  • Diego Couto
    Diego Couto over 7 years
    I was having some issues with masked dates. Updating masked-input and setting the input type to date solved my problem too.
  • Hugo Delsing
    Hugo Delsing over 7 years
    Setting it to "date" did not solve it for me. Even though i'm using a mask for a date, I had to set it to type="tel"
  • puddleglum
    puddleglum over 7 years
    Thanks! Doing only the first two was necessary for me on a bootstrap 3+ form-control