Can we enable the iphone number keyboard without using type = number?

I am doing a webapp and I would like the input field to display the Iphone number keypad. I understand that type=number will make the keyboard the way I would like.

The problem is that type=number does not support placeholder text. Therefore, if I wanted to:

Date of expiration:
[example: 2010]

I can not get it to work, and also show the correct keyboard.

Is there a way to get the iPhone keyboard to go into numeric mode without using the number input type?

+4
source share
1 answer

Placeholder seems to work (as in Safari on my Mac, like Mobile Safari on my iPhone; Compatibility List ).

 <input type="number" placeholder="2010"> 

http://jsfiddle.net/XPL48/

Otherwise, use JavaScript to create a placeholder, for example. this jQuery plugin: http://plugins.jquery.com/project/placeholder .

+3
source

Source: https://habr.com/ru/post/1335317/


All Articles