Try it in the keydown event or Keyup event