Use:
$(document).keydown(function (e) {
var nodeName = e.target.nodeName.toLowerCase();
if (e.which === 8) {
if (((nodeName === 'input' && (e.target.type === 'text' || e.target.type === 'email')) ||
nodeName === 'textarea') && e.target.readOnly == false) {
// do nothing
} else {
e.preventDefault();
}
}
});
Reference:
http://stackoverflow.com/questions/6309693/disabling-backspace-key-works-in-all-browsers-but-ie
$(document).keydown(function (e) {
var nodeName = e.target.nodeName.toLowerCase();
if (e.which === 8) {
if (((nodeName === 'input' && (e.target.type === 'text' || e.target.type === 'email')) ||
nodeName === 'textarea') && e.target.readOnly == false) {
// do nothing
} else {
e.preventDefault();
}
}
});
Reference:
http://stackoverflow.com/questions/6309693/disabling-backspace-key-works-in-all-browsers-but-ie
No comments:
Post a Comment