$('#lottoStage').keydown(function(){
if(event.keyCode == 46 || event.keyCode==8){
$(this).val('');
return true;
}
if(!(event.keyCode==46)&&!(event.keyCode==8)&&!(event.keyCode==37)&&!(event.keyCode==39)){
if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105))){
event.returnValue=false;
}
}
});
转载于:https://www.cnblogs.com/austinspark-jessylu/p/6136974.html