Built-in input does not work on Android phones

Hi, I used a masked input click plugin for my site to format the phone number that the user enters. I use a format like (123) 456-7890 works fine with a PC, but when I browse the site using Android devices and enter a phone number like 1234567890 , its order changes as (213) 456-7890 or any random order automatically.

You can see this problem on your demo site, here is the link on the goto demo tab next to the usage tab.

can someone suggest me a solution for the same.

+6
source share
3 answers

I solved this problem with three actions that fixed this for all Android 4.0+ phones:

  • Masked input update at least version 1.4
  • Add type="tel" to the input to call the phone keypad
  • Remove the input attribute maxlength or set it to a value that should not interfere with the caret action, e.g. 20 .
+7
source

Quote: Jonathan Rowny on a masked tab not working on Android mobile phones. ":

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

+2
source
 <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 believe using a class works best ... Good luck.

-5
source

Source: https://habr.com/ru/post/957849/


All Articles