File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -369,15 +369,18 @@ $.widget("ui.dialog", {
369
369
}
370
370
if ( hasButtons ) {
371
371
$ . each ( buttons , function ( name , props ) {
372
+ var button , click ;
372
373
props = $ . isFunction ( props ) ?
373
374
{ click : props , text : name } :
374
375
props ;
375
- var button = $ ( "<button type='button'></button>" )
376
- . attr ( props , true )
377
- . unbind ( "click" )
378
- . click ( function ( ) {
379
- props . click . apply ( that . element [ 0 ] , arguments ) ;
380
- } )
376
+ // Default to a non-submitting button
377
+ props = $ . extend ( { type : "button" } , props ) ;
378
+ // Change the context for the click callback to be the main element
379
+ click = props . click ;
380
+ props . click = function ( ) {
381
+ click . apply ( that . element [ 0 ] , arguments ) ;
382
+ } ;
383
+ button = $ ( "<button></button>" , props )
381
384
. appendTo ( that . uiButtonSet ) ;
382
385
if ( $ . fn . button ) {
383
386
button . button ( ) ;
You can’t perform that action at this time.
0 commit comments