786543214
786543214

Reputation: 855

Masked input is not working in android phones

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.

Upvotes: 9

Views: 13005

Answers (3)

Tony Brasunas
Tony Brasunas

Reputation: 4582

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.

Upvotes: 9

PolGraphic
PolGraphic

Reputation: 3364

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

Upvotes: 2

leejsci
leejsci

Reputation: 1

<script src="js/jquery.maskedinput.min.js" type="text/javascript">http://    digitalbush.com/projects/masked-input-plugin/</script>
<script type="text/javascript"> //input mask
jQuery(function($){
    $(".date").mask("99/99/9999");
    $(".phone").mask("(999) 999-9999");
    $(".zip").mask("99999");
    $(".year").mask("9999");
    //,{placeholder:" "}
    });
</script>

html

<input class="phone" id = "aligned-phone" type="tel" name="phone" value="<%=phone %>"   Placeholder = "Cell Phone" autocomplete="<%= autofill%>">

i find that using class works the best... Good luck

Upvotes: -5

Related Questions