Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger numeric keyboard for input in Android/IOS without HTML5

I've searched through the websites that I found the following.

Using html5, we can trigger numeric keyboard with effortless like following,

<input type='tel' />
<input type='number'/>
<input type='text' pattern='some pattern' /> (This will work in IOS and not in android)

But I am using the autoNumeric plugin to format/restrict the user input if as digits. As per the documentation of autoNumeric plugin (http://www.decorplanit.com/plugin/), autoNumeric won't work if input type='tel/number' . I tried and yes it doesn't work.

  • If I go with the HTML5 and removing autoNumeric, will reflect in the way that my application won't be user friendly. To make it user friendly I need to do more code changes (It should be researched perfectly before start :-( ).
  • If I go with autoNumeric, then my application won't be user friendly in MOBILE.
  • If I go with another plugin instead of autoNumeric and that support HTML5, then I need to rework with whole project and testing time will take more cost.

Here my requirement is,

How to enable/trigger numeric keyboard in mobile/ipad/iphone without html5 ?

Or

Is there any jquery plugin to enable/trigger numeric keyboard in mobile/ipad/iphone without html5 and with autoNumeric js (autonumeric js)?

like image 577
Jeeva J Avatar asked Jan 09 '23 08:01

Jeeva J


2 Answers

As per the documentation, Version 1.9.19 added support for <input type='tel' />

So, why not use that?

like image 74
Salil Dabholkar Avatar answered Jan 22 '23 15:01

Salil Dabholkar


Official workarounds from autoNumeric.js are

  1. <input type="text" pattern="\d*"> Currently works on iOS only
  2. <input type="tel" pattern="\d*"> Should work on most mobile browsers - on android devices you may get the pause and wait buttons.

If you need decimal digits, you may modify the pattern to [\d\.]*.

like image 27
Alex Klaus Avatar answered Jan 22 '23 16:01

Alex Klaus