HTML event onkeypress
Event Attribute onKeyPress
- The element is focused and a key is pressed
In this example, the user will receive a messagebox saying "You pressed a key over the text", after focusing on the element and pressing a key.
<input type="text" onkeypress="alert('You pressed a key over the text')" value="Focus and press a key" />