hi I am writing a javascript widget which handles keyboard events. The issue in question arises when i show a div and want to hide it when someone presses esc.
what's the best way to achieve the following (i am using jquery in this project )
var escToExit = function(e){
// code to check for esc
// i then want to call the instance of widget that is linked to this function
}
var widget = {
show : function(){
$(document).keyup(escToExit);
},
hide : function(){
//hide code here
}
}
thanks