Changed keydown to keyup.

Ideally, using oninput is even better (in the latest browsers that support it), because it detects all possible ways that input can be changed, e.g. cut, delete from context menu, etc.
Merge pull request #1 from shurcooL/patch-1

Changed keydown to keyup.