Reputation: 39
What is the eventCode for backspace in Chrome and Firefox?
Upvotes: 1
Views: 1941
Reputation: 40970
Event code for backspace is 8
e.keyCode === 8
You can get more information from here
Upvotes: 5
Reputation: 1634
The key code for backspace is 8.
document.onkeydown = KeyCheck;
function KeyCheck()
{
var KeyID = event.keyCode;
switch(KeyID)
{
case 8:
alert("backspace");
break;
default:
break;
}
}
Upvotes: 1
Reputation: 307
You can find out with the following javascript which code is pressed:
$(window).bind("keydown",function(e){
var code = e.keyCode || e.which;
console.log(code);
});
Upvotes: 0