Header Part:
<link rel="stylesheet" href="https://sweetalert2.github.io/styles/bootstrap4-buttons.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
Body Part Add A Button:
<a href="" id="delete" class="btn btn-danger">Delete</a>
jQuery Part:
$(document).on("click", "#delete", function (e) {
e.preventDefault();
var link = $(this).attr("href"); 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'
) } }) });
showConfirmButton:false
in your configuration. Link to the Documentation – Eanes