


Using jquery to realize that pressing backspace in IE is equivalent to the return operation_jquery
May 16, 2016 pm 04:55 PMIn 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);
});

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What is the delete key on the keyboard?

PHP Tips: Quickly Implement Return to Previous Page Function

What should I do if win11 cannot use ie11 browser? (win11 cannot use IE browser)

Internet Explorer opens Edge: How to stop MS Edge redirection

What results does MySQL return after inserting data?

How to cancel the automatic jump to Edge when opening IE in Win10_Solution to the automatic jump of IE browser page

How to solve the problem that IE shortcut cannot be deleted
