Which of the following input element options will display the numeric keypad in mobile browsers?

What is the correct code. Any ideas.

<input type="text" pattern="[0-9]*"/>

<input type="number"/>

<input type="text" keyboard="numeric"/>

<input type="text" keyboard="number11"/>



source to share

2 answers

You have to use the following input, both will work:

<input type="number" />
<input type="tel" />




It depends. If you are using it <input type="number">

, the browser will display it as a numeric input containing up and down buttons to cycle through the value. If you only want numbers and no buttons, use a template.



All Articles