Changed keypress to keydown, so it works in Chrome and Safari