diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index c1ac7bc9e..a031eb5e0 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -369,15 +369,18 @@ $.widget("ui.dialog", {
}
if ( hasButtons ) {
$.each( buttons, function( name, props ) {
+ var button, click;
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
- var button = $( "" )
- .attr( props, true )
- .unbind( "click" )
- .click(function() {
- props.click.apply( that.element[0], arguments );
- })
+ // Default to a non-submitting button
+ props = $.extend( { type: "button" }, props );
+ // Change the context for the click callback to be the main element
+ click = props.click;
+ props.click = function() {
+ click.apply( that.element[0], arguments );
+ };
+ button = $( "", props )
.appendTo( that.uiButtonSet );
if ( $.fn.button ) {
button.button();