user1338040
user1338040

Reputation: 39

What is the eventCode for backspace?

What is the eventCode for backspace in Chrome and Firefox?

Upvotes: 1

Views: 1941

Answers (3)

Sachin
Sachin

Reputation: 40970

Event code for backspace is 8

e.keyCode === 8

You can get more information from here

Upvotes: 5

Dilantha
Dilantha

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

Flashin
Flashin

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

Related Questions