I have code to open a jQueryUI
dialog with two buttons (OK, and Cancel). When the dialog opens, I want the OK button to have focus by default. After that, when I press the ENTER key, it should perform the actions associated with the OK button. How do I make this happen?
Use this code:
open: function() {
$(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:eq
(1)').focus();
$(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:eq
(0)').blur();
},