Making Telephone (numeric) keypad display on iPads | XM Community
Skip to main content

I've searched around and found some javascript that will force the numbers to appear on a standard iPad keyboard, as follows:
jQuery("#"+this.questionId+" .InputText").attr('type', 'tel');

But I would like to only show the numeric keypad. I saw some mention of

inputmode = numeric 
being supported for iOS devices and
pattern="[0-9]*" 
but I don't know how to integrate it with the above.
Any javascript pros know how to help?

Hi there, try inputting the below JS. It will make it so that only the values 0-9 can be inputted.
jQuery("#"+this.questionId+" .InputText").attr( { type:"number", onkeydown:"if(event.key==='.'){event.preventDefault();}", oninput:"event.target.value = event.target.value.replace(/[^0-9]*/g,'');" } );


Leave a Reply