$(document).keydown(function (e) {
var doPrevent;
// for IE && Firefox
var varkey = (e.keyCode) || (e.which) || (e.charCode);
if (varkey == 8) {
var d = e.srcElement || e.target;
if (d.tagName.toUpperCase() == 'INPUT' || d.tagName.toUpperCase() == 'TEXTAREA') {
doPrevent = d.readOnly || d.disabled;
// for button,radio and checkbox
if (d.type.toUpperCase() == 'SUBMIT'
|| d.type.toUpperCase() == 'RADIO'
|| d.type.toUpperCase() == 'CHECKBOX'
|| d.type.toUpperCase() == 'BUTTON') {
doPrevent = true;
}
}
else {
doPrevent = true;
}
}
else {
doPrevent = false;
}
if (doPrevent)
e.preventDefault();
});
JQuery 屏蔽 jsp 页面 Backspace
最新推荐文章于 2021-04-03 04:19:38 发布