masked input not working in android mobiles?

Durga Prasad picture Durga Prasad · Aug 26, 2013 · Viewed 45.7k times · Source

I am using the digitalbush masked input jQuery plugin. It is working fine in web browsers and the iPhone browser perfectly, but it is not working for Android mobile devices.

My issue : mask is in input field _ - _ - ___.

When I type numbers it will 12345685555___--

Example: http://rossbender.com/temp/mask.html

Any suggestions? How can I solve this?

Thanks Prasad.

Answer

Tony Brasunas picture Tony Brasunas · Apr 3, 2015

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 numeric keyboard
  3. Remove the input's maxlength attribute or set it to a value certain not to interfere with the caret action, like 20.