I want to prevent number input on keydown event on textfield and run custom handler function. Here are the issues
e.target.value
is useless since the key value is not projected into the target value yete.keyCode
for number depends on keyboard type, language layout, Fn or Shift keyString.fromCharCode(e.keyCode)
is not reliable, at least on my keyboard (Czech qwerty)- w3 specification says
e.keyCode
is a legacy attribute and suggestse.char
instead, but it is not implemented in browsers yet
So how to catch the number input before it appears in the textfield?