Adding a keydown event to a jQuery modal popup window with dynamic content
<p>I have created functions to create a Yes/No confirm window that popups with jQuery that I use in a .net project to confirm responses from the user. I have generated buttons that trigger functions depending on what you click on.</p>

<p>//load a specailized popup for confirming things in a localized manner
function popupConfirm(TitleKey, InstructionsKey, YesFunction, NoFunction) {</p>

<pre><code>//create the service to give us the content
var agpc = new AjaxServices.AjaxPopUps();

//get the results and open the popup with the functions aligned
agpc.GetLocalizedStrings(new Array(TitleKey, InstructionsKey, "Yes", "No"), function (results) {
    var content = jQuery.parseJSON(results.toString());

    //get the buttons for confirm/or not
    var YesNoButtons = jQuery('&lt;div&gt;&lt;/div&gt;', { id: 'YesNoButtons' });
    var yesButton = jQuery('&lt;a&gt;' + content.Yes + '&lt;/a&gt;');
    var noButton = jQuery('&lt;a&gt;' + content.No + '&lt;/a&gt;');

    //add the event handlers
    yesButton.click(YesFunction);
    noButton.click(NoFunction);

    //set a nice pointer for mouse over
    yesButton.css({ cursor: 'pointer' });
    noButton.css({ cursor: 'pointer' });

    YesNoButtons.append(yesButton).append(noButton);
    //show the box
    openPopup("Non-JSON", YesNoButtons, eval('content.' + TitleKey), eval('content.' + InstructionsKey));

    });
}
</code></pre>

<p>Well now comes the difficult part. The company also wants keypresses to trigger the yes/no functions. An enter key should trigger yes and escape should trigger no. I have no real idea how I will do this with this type of setup.</p>

<p>You can ignore most of the code in there. It is to get localized strings from the server. It the adding the keydown() event that I can't figure out.</p>

<p>Any ideas?</p>
