Is there a quick way to set an HTML text input () to only allow numeric keystrokes (plus \'.\')?
input type="number" is an HTML5 attribute.
input type="number"
In the other case this will help you:
function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : evt.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; }