Hard to tell what you might be doing wrong from 5 lines of code. Can you
post a link to your site, or make a demo using jsFiddle or Plunkr?
As well, "doesn't work" doesn't tell us much.
No idea what you mean by "isn't retained in memory".
No, there's nothing to "retain". Once it has been fired
once, it's been fired. You need to register it again.
It will be more convenient if you define a function for the keypress event.
function
myKeypressFunction() {
// do something here
});
$(document).one('keypress',
'button', myKeypressFunction);
You re-enable it exactly the same way.
$(document).one('keypress',
'button', myKeypressFunction);