This is an example of one might implement a key listener with MochiKit’s Signal.
For a detailed description of what happens under the hood, check out key_events.js.
View Source: [ index.html | key_events.js | key_events.css ]
Check this box to test preventDefault() in your browser:
This text is replaced with a message when you press Escape or F1.
Event | Key Code | Key String |
---|---|---|
onkeydown | - | - |
onkeyup | - | - |
onkeypress | - | - |
Shift | Ctrl | Alt (Option) | Meta (Command) |
---|---|---|---|
- | - | - | - |