时间:2021-07-01 10:21:17 帮助过:2人阅读
$(function(){
function dokey(event){
var ele = event.target;
var eleName = ele.nodeName;
var flag = true;
if(eleName=="INPUT"||eleName=="TEXTAREA"||eleName=="SELECT"){
var re = $(ele).attr("readonly");
if(re){
flag = true;
}else{
flag = false;
}
}
if(event.which==8&&flag){
event.preventDefault();
event.stopPropagation();
}
}
$(document).keypress(dokey).keydown(dokey);
});