/ Published in: JavaScript
send in an event it returns the key that you pressed if it was alphanumeric or backspace otherwise it returns "-1" use with getKeyCode and isAlphaNumeric
Expand |
Embed | Plain Text
function getCharacterPressed(e) { code = getKeyCode(e); keychar = "-1"; if (isAlphaNumeric(code)) keychar = String.fromCharCode(code); if (code == 8) keychar = "backspace"; return keychar; }
You need to login to post a comment.
