Why when you press the delete key and return key

I do not ask about it because I need a job. I have one that works great, but I want to know WHY this is not the case. Is this a bug in javascript (or jQuery because I use the jQuery .keypress handler) or is there a specific reason why this is so?

Thanks in advance.

+7
javascript javascript-events onkeypress keypress
source share
2 answers

The keypress event keypress designed to process the character entered by the user, and not detect keyboard activity, and the delete and return keys do not generate characters. Some browsers blur this line somewhat, but the general principle is that the keyup and keydown detect any key pressed and tell you which key it has, and keypress to detect the actual character.

+15
source share

The short answer is that the onkeypress event does not fire for all types of keys in all browsers. Check the manual for your browser.

Why?

Probably not the complete answer, but consider Shift when it drops and when it appears relative to other keys is significant. And other keyboard hardware has different key rollover characteristics that you might want to know in detail.

+2
source share

All Articles