Skip to content

Instantly share code, notes, and snippets.

@NV
Created May 4, 2010 14:36
Show Gist options
  • Select an option

  • Save NV/389480 to your computer and use it in GitHub Desktop.

Select an option

Save NV/389480 to your computer and use it in GitHub Desktop.
<script>
KeyboardEvent.prototype.__defineGetter__('character', function(){
return (this.ctrlKey || this.altKey || this.metaKey || !this.charCode)
? ""
: String.fromCharCode(this.charCode);
});
onkeypress = function(e){
document.getElementById('char').innerHTML += e.character + ' '
}
</script>
<div id="char"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment