title: Only allow numbers, backspace and delete keys on input text
body: <p>I have this input text in a HTML5 page:</p>
  
  <pre><code>&lt;input type="text" class="quantity" 
  onkeypress='return (event.charCode &gt;= 48 &amp;&amp; event.charCode &lt;= 57) || event.charCode == 8 || event.charCode == 46' required /&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>The code above only allows numbers. How can I allow also backspace and delete?</p>