When using, .keydownI can capture the keydown event, and then check and prevent the default action (display the character).
When using .keyupcan not I?
I know that an event is recorded as alert()triggered when the code is inside the condition, but preventDefault()does not prevent the action.
Here is the complete demo
Aaron source
share