I have made following code, but whatever I type it will always print some odd char.
$(document).keypress(function(event) {
var character = String.fromCharCode(event.keyCode);
$("body").append(character);
event.preventDefault();
return false;
});
keyCodeis not the same as acharCode, they are different maps (And differ somewhat between browsers with arrow keys and such).Think about it this way, what letter is Escape, or Delete?