In fact, disabling it does not mean disabling it completely. The back key defaults to clicking the back button in each browser. As long as it can still be used for normal text input, the backspace key in other situations will be disabled. Let’s look at the jquery implementation code:
$(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);
});