sweetalert
sweetalert copied to clipboard
button className is not working
I tried to add bootstrap button class on the button. But it didn't work Checked the html output source, my custom class names are not added
swal({
text: "Form has not completed. Submission failed",
icon: "warning",
button: {
confirm: {
text: "OK",
className: "btn btn-primary",
},
}
});
Hi, I am also having the same issue.
swal({ title: 'Recover Item', text: 'Would you like to recover the selected items?', buttons: { confirm: { text: "Yes", value: true, visible: true, className: "bg-warning", closeModal: true, }, cancel: { text: "Cancel", value: true, visible: true, className: "bg-default", closeModal: true, } } }, function () { ... });
className failed to take more than one classes.
Failed to execute 'add' on 'DOMTokenList': The token provided ('btn btn-success') contains HTML space characters
`const swalWithBootstrapButtons = Swal.mixin({ customClass: { confirmButton: 'btn btn-success', cancelButton: 'btn btn-danger' }, buttonsStyling: false })
swalWithBootstrapButtons.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonText: 'Yes, delete it!', cancelButtonText: 'No, cancel!', reverseButtons: true }).then((result) => { if (result.isConfirmed) { swalWithBootstrapButtons.fire( 'Deleted!', 'Your file has been deleted.', 'success' ) } else if ( /* Read more about handling dismissals below */ result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( 'Cancelled', 'Your imaginary file is safe :)', 'error' ) } })`
Add class in customClass