How can I prevent user from inserting characters in Text Box other than Only numbers can insert jQuery Mobile

Viewed 17700

I implemented iphone&android app in jQuery mobile.* i used **pure jQuery mobile

To enter phone `number in a text box. I used TYPE=”TEL”' this is for numaric keypad.

<input type="tel" style=" width:81%;" id="contactNumber" value="" class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset" /> 

But user can enter text also the text box which is unnecessary thing.

How can I prevent user from inserting characters other than numbers?

For mobile devices users it would be much more comfortable if the only input possibile is numeric, as they must press each button to get a number rather than a letter!

I tried adding TYPE=”TEL” TYPE=”mumber” in the input field, but it does not work to prevent.

6 Answers
Related