use keydown event rather than keypress