change keyup to keypress to fix bug when switch pages.