swal confirm button class code example
Example 1: switch alert
swal({
title: "Good job!",
text: "You clicked the button!",
icon: "success",
button: "Aww yiss!"
});
Example 2: swal change confirm button class
Swal.fire({
title: 'example text',
buttonsStyling: false,
customClass: {
confirmButton: 'example-class'
}
})
Example 3: sweet alert add custom button
$(document).on('click', '.SwalBtn1', function() {
console.log('Button 1');
swal.clickConfirm();
});
$(document).on('click', '.SwalBtn2', function() {
console.log('Button 2');
swal.clickConfirm();
});
$('#ShowBtn').click(function(){
swal({
title: 'Title',
html: "Some Text" +
"<br>" +
'<button type="button" role="button" tabindex="0" class="SwalBtn1 customSwalBtn">' + 'Button1' + '</button>' +
'<button type="button" role="button" tabindex="0" class="SwalBtn2 customSwalBtn">' + 'Button2' + '</button>',
showCancelButton: false,
showConfirmButton: false
});
});
Example 4: swal confirm
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Yes, I am sure!',
cancelButtonText: "No, cancel it!"
}).then(
function () { },
function () { return false; });