From 95a34593f98217e3a99f223e2ef3ca0a0fa8343b Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 31 Aug 2010 10:17:53 -0400 Subject: Dialog: Added additional syntax for creating buttons. Fixes #4344 - Dialog: Enhanced Button Option. --- ui/jquery.ui.dialog.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'ui/jquery.ui.dialog.js') diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index ff2375164..17300b178 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -357,10 +357,15 @@ $.widget("ui.dialog", { }); } if (hasButtons) { - $.each(buttons, function(name, fn) { - var button = $('') - .text(name) - .click(function() { fn.apply(self.element[0], arguments); }) + $.each(buttons, function(name, props) { + props = $.isFunction( props ) ? + { click: props, text: name } : + props; + var button = $('', props) + .unbind('click') + .click(function() { + props.click.apply(self.element[0], arguments); + }) .appendTo(uiButtonSet); if ($.fn.button) { button.button(); -- cgit v1.2.3