aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-08-31 10:17:53 -0400
committerScott González <scott.gonzalez@gmail.com>2010-08-31 10:17:53 -0400
commit95a34593f98217e3a99f223e2ef3ca0a0fa8343b (patch)
treec4aa2ddd57cdbe9722fc67e5ea992874cfddbb61 /ui
parentdea2f8a7fc1d7c1d8fbf69aa50d7c1f28c3f35b6 (diff)
downloadjquery-ui-95a34593f98217e3a99f223e2ef3ca0a0fa8343b.tar.gz
jquery-ui-95a34593f98217e3a99f223e2ef3ca0a0fa8343b.zip
Dialog: Added additional syntax for creating buttons. Fixes #4344 - Dialog: Enhanced Button Option.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.dialog.js13
1 files changed, 9 insertions, 4 deletions
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 = $('<button type="button"></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 = $('<button></button>', props)
+ .unbind('click')
+ .click(function() {
+ props.click.apply(self.element[0], arguments);
+ })
.appendTo(uiButtonSet);
if ($.fn.button) {
button.button();