3 ms·
after you gave him your "clever" answer, you should have followed up with mentioning that keypress is the wrong event to use, but rather "keyup", since keypress
by ultimatedelman 13y ago
after you gave him your "clever" answer, you should have followed up with mentioning that keypress is the wrong event to use, but rather "keyup", since keypress varies across browsers and doesn't account for the holding down of keys. try holding down a key in your demo to see what happens :)
- Hengjie 13y agoKeyup doesn't account for holding down keys either. It's keydown that is what you're after for that one.
- dmbass 13y agoYou want the oninput event, but IE < 10 has horrible support for it. Figuring out when the input value has changed is a lot more complicated than picking one of onkeyup/down/pressed.