keywatcher
JS For watching key inputs
Two functions:
watchKeys(inputEl, keyPress, onDelete)
Params
- inputEl: the element to listen on
- keyPress: a callback for any keypressed
- onDelete: a callback for the backspace or delete key pressed
watchKeyup(inputEl, keyUp)
Params
- inputEl: the element to listen on
- keyUp: the callback for a key released
Example
var el = document
Notes
- watchKeys uses the keyPressed event, which is currently
deprecated
. See MDN - the keyPress callback is not called when the delete or backspace key is pressed