Skip to content

Instantly share code, notes, and snippets.

@jena-th
Created December 28, 2011 12:10
Show Gist options
  • Select an option

  • Save jena-th/1527752 to your computer and use it in GitHub Desktop.

Select an option

Save jena-th/1527752 to your computer and use it in GitHub Desktop.
Keycode handling
if (event.which == null)
char= String.fromCharCode(event.keyCode); // old IE
else if (event.which != 0 && event.charCode != 0)
char= String.fromCharCode(event.which); // All others
else
// special key
@jena-th

jena-th commented Dec 28, 2011

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment