Closed brgrz closed 11 years ago
Like this
// Modified buttons initialisation here
var buttons = {};
buttons[locale.button[0]] = function () {
$(dialog).dialog("close");
};
buttons[locale.button[1]] = function () {
// Unbind overriding handler and let default actions pass through
$target.unbind(type, handler);
// Close dialog
$(dialog).dialog("close");
// Check if there is any events on the target
if (jQuery.data(target, 'events')) {
// Trigger click event.
$target.click();
}
else {
// No event trigger new url
urlClick();
}
init();
};
The order of the buttons are now kept intact, however the OK button is still focused by default (since this seam to be the default behavior of chrome/firefox).
Since it's impossible to change the order of the buttons on the fly, I propose you change the button initialisation so that it keeps the order as set in the "button: ..." option (currently you change those two up, putting the 2nd one first and the 1st one second) and to favor that the "Cancel" gets selected by default (preventing accidental confirms).