How to store a bound key for later retreival
Hello everyone.
I though I'd give these forums a shot. I'm having trouble figuring out how to accomplish something and was hoping someone could help.
I currently have the 'enter' key bound to a submit event on several on my pages, as follows.
$(document).bind('keydown','return',function(){ $("#searchSearchButton").click(); });
It works well, with one problem. I've written over the alert function with my own custom alert. When the alert pops up, I try to hit 'enter' to close the alert and nothing happens because the enter key is bound to something else.
I've found that if I unbind the enter key and rebind it to close my alert box, that works fine, but I can't figure out how, after the alert box is closed, to rebind it to the previous value. I'd have to grab the existing bind value before rebinding it to close the alert box, then replace that value afterward, but I have no clue how to grab the bind key's value.
Does anyone have any suggestions? I'd appreciate any help.