swal fire as spy code example
Example 1: sweet alert 2 do action on confirm
Swal.fire({
title: 'Do you want to save the changes?',
showDenyButton: true, showCancelButton: true,
confirmButtonText: `Save`,
denyButtonText: `Don't save`,
}).then((result) => {
if (result.isConfirmed) {
Swal.fire('Saved!', '', 'success')
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
});
Example 2: jquery sweet popup
$.sweetModal({
title: {
tab1: {
label: 'Tab 1'
},
tab2: {
label: 'Tab 2'
}
},
content: {
tab1: 'Tab 1',
tab2: 'Tab 2'
},
buttons: {
someOtherAction: {
label: 'Action 2',
classes: 'secondaryB bordered flat',
action: function() {
return $.sweetModal('You clicked Action 2!');
}
},
someAction: {
label: 'Action 1',
classes: '',
action: function() {
return $.sweetModal('You clicked Action 1!');
}
},
}
});