I want to prevent number input on keydown event on textfield and run custom handler function. Here are the issues
e.target.valueis useless since the key value is not projected into the target value yete.keyCodefor 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.keyCodeis a legacy attribute and suggestse.charinstead, but it is not implemented in browsers yet
So how to catch the number input before it appears in the textfield?