WaitButton Callback Variations
The WaitButton widget extends the default jQueryUI Button widget by adding a spinner and disabling the
button when its clicked. Only one click is allowed until a callback is executed from the
waiting
event handler.
Default completion - return to the start state
$('#save-1')
.waitbutton({ waitLabel: 'Saving ...' })
.on( 'buttonwaiting', function ( e, ui ) {
setTimeout(function () { ui.done(); }, 2000);
});
Return to original label, but leave disabled
$('#save-2')
.waitbutton({ waitLabel: 'Saving ...' })
.on( 'buttonwaiting', function ( e, ui ) {
setTimeout(function () { ui.done( false ); }, 2000);
});
Change to a different label, but enable the button
$('#save-3')
.waitbutton({ waitLabel: 'Saving ...' })
.on( 'buttonwaiting', function ( e, ui ) {
setTimeout(function () { ui.done( 'Saved' ); }, 2000);
});
Change to a different label and leave disabled
$('#save-4')
.waitbutton({ waitLabel: 'Saving ...' })
.on( 'buttonwaiting', function ( e, ui ) {
setTimeout(function () { ui.done( 'Saved', false ); }, 2000);
});