I have this input text in a HTML5 page:
<input type="text" class="quantity"
onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.charCode == 8 || event.charCode == 46' required />
Because I need an input text that does allow only numbers, but I could need also delete a number. When I press backspace or delete nothing happens.
The code above only allows numbers. How can I allow also backspace and delete?