I take what the user input with event.which when a key is pressed, and output using String.fromCharCode.
User Types: a
event.which: 67
Outputs: A
I can refer to numbers and letters, but when it comes to special characters, I get completely different outputs.
User types: -
event.which: 189
Outputs: ½
After researching, I came across the charCodeAt function, and using this, the output is completely, even special characters.
Unfortunately, I cannot use charCodeAt, because the user types directly from $ (document), and not from the field.
So the question is, is there a way to get the correct charCode from the keyPress.which event?
If I still can not understand my doubts, I made you Fiddle =)
BernaMariano
source share