Keydown with number value only
Keydown with number value only not enter alphabat
by Ankit Patidar
HTML
Only numbers please:
<input type="text" name="someid" class="quantityinput" />
JavaScript
$(".quantityinput").keydown(function(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57 && charCode < 96 || charCode > 105))//96 to 105 user for numpad
//if (charCode > 31 && (charCode < 37 || charCode > 40 && charCode < 46 || charCode > 57 && charCode < 96 || charCode > 105))//31 to 37 for left right && 96 to 105 user for numpad
return false;
return true;
});