Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Numeric Keyboard for Mobile Device

This is not a "mobile" website. It is regular HTML/CSS. Is there a way I can force mobile devices to popup with the numeric keyboard when they focus on my textboxes?

like image 792
divided Avatar asked Jan 20 '11 20:01

divided


1 Answers

We've had the best luck with using a combination of type="number" and pattern="\d*". We've seen success on iOS and Android devices, although I don't have a list of OS versions to share here.

<input type="number" pattern="\d*" name="year">
like image 84
awayken Avatar answered Sep 22 '22 06:09

awayken