input type number type any code example
Example 1: number input html
<input id="number" type="number" value="42">
Example 2: input number has empty value
The hack is to use type="tel" instead of type="number".
This solves the 2 main issues:
It pulls up a number keypad on mobile devices
It validates (and is not empty) with numbers or non-numbers as input.