The onkeypress event

The onkeypress event is triggered when the user both presses a key down and also lets the key back up again—just for completeness’s sake.

✓ Tip

  • If you’re not sure what the key values are for a particular key, you can find out by putting the line alert(thiskey); in between the lines of code in steps 5 and 6, then, press the key for which you want to find the value. The alert box contains the numeric key value.

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.