I have a web application where I\'m specifying an input field to be a number using the HTML5 property type=\"number\".
Refer to my answer for this similar question.
I believe using is most logical for avoiding this pitfall currently. The other options are intriguing and slightly new to me (like the pattern attribute) but I found them to be unsatisfactory for my design. You can look at a screenshot of a mobile application I complete for Hilton not too long ago here (it's actually shown in the answer I first referenced).