<input type="number" min="1" onkeyup="this.value=this.value.replace(/[^\d]/,'')"name="Qty[]" placeholder="Qty" value="0">
This is my html input and using this regular expression I am able to replace all alphabets. Input gets blanked. Although I tried putting in zero like so
onkeyup="this.value=this.value.replace(/[^\d]/,'0')"
But it does not replace it with zero. Also the above provided expression replaces the whole string, whereas I want to if I input '1234a' it just removes the 'a' . So either anyone could tell me how to replace the whole alphabets with 0 or just removes the alphabets from the input.
Sample inputs: 1234a
Intended outputs: 0 or 1234