Is there a quick way to set an HTML text input () to only allow numeric keystrokes (plus \'.\')?
So simple....
// In a JavaScript function (can use HTML or PHP).
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
In your form input:
With input max. (These above allows for a 12-digit number)