This page listens for keypress events when any element has focus (global listener). Open the virtual keyboard and start typing to see how keypress events can be captured at a global level.
The following input box and text area have their own keypress event handlers. Place focus on either of these input fields and start typing to see what happens: