input number js 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: number input html
<input id="number" type="number" value="42">