input type number html code example
Example 1: html restrict input to numbers
<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" />
Example 2: html input box integer only
<input type="number" name="someid" />
Example 3: number input html
<input id="number" type="number" value="42">
Example 4: html5 number integer
<input type="number" step="1" />