admin管理员组

文章数量:1026989

I want to use a confirm dialog that looks better than the one produced by the build-in JavaScript confirm() method.

I have tried Toastr but found that the confirmfunctionality was a bit tricky to achieve with No/Yes buttons. It has to still be maintained and updated.

Thanks for all suggestion!

I want to use a confirm dialog that looks better than the one produced by the build-in JavaScript confirm() method.

I have tried Toastr but found that the confirmfunctionality was a bit tricky to achieve with No/Yes buttons. It has to still be maintained and updated.

Thanks for all suggestion!

Share Improve this question edited May 8, 2020 at 11:04 codebod 6846 silver badges17 bronze badges asked Dec 20, 2017 at 8:37 AllramEstAllramEst 1,4594 gold badges28 silver badges55 bronze badges 2
  • I use this along with toastr craftpip.github.io/jquery-confirm – Sanal S Commented Dec 20, 2017 at 8:45
  • super. Was just browsing on that page – AllramEst Commented Dec 20, 2017 at 8:46
Add a ment  | 

2 Answers 2

Reset to default 3

I think that one of the most beautiful API out there is SweetAlert2.

You can set up your dialogs as follows:

swal({
    title: 'Are you sure?',
    text: "You won't be able to revert this!",
    type: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!'
}).then((result) => {
    if (result.value) {
        swal(
        'Deleted!',
        'Your file has been deleted.',
        'success'
        )
    }
})


This is how it looks like:

You can even customize the CSS to adapt it to your project colors.

Hope this helps!

Try jquery-confirm. They have a variety of designs.

I want to use a confirm dialog that looks better than the one produced by the build-in JavaScript confirm() method.

I have tried Toastr but found that the confirmfunctionality was a bit tricky to achieve with No/Yes buttons. It has to still be maintained and updated.

Thanks for all suggestion!

I want to use a confirm dialog that looks better than the one produced by the build-in JavaScript confirm() method.

I have tried Toastr but found that the confirmfunctionality was a bit tricky to achieve with No/Yes buttons. It has to still be maintained and updated.

Thanks for all suggestion!

Share Improve this question edited May 8, 2020 at 11:04 codebod 6846 silver badges17 bronze badges asked Dec 20, 2017 at 8:37 AllramEstAllramEst 1,4594 gold badges28 silver badges55 bronze badges 2
  • I use this along with toastr craftpip.github.io/jquery-confirm – Sanal S Commented Dec 20, 2017 at 8:45
  • super. Was just browsing on that page – AllramEst Commented Dec 20, 2017 at 8:46
Add a ment  | 

2 Answers 2

Reset to default 3

I think that one of the most beautiful API out there is SweetAlert2.

You can set up your dialogs as follows:

swal({
    title: 'Are you sure?',
    text: "You won't be able to revert this!",
    type: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!'
}).then((result) => {
    if (result.value) {
        swal(
        'Deleted!',
        'Your file has been deleted.',
        'success'
        )
    }
})


This is how it looks like:

You can even customize the CSS to adapt it to your project colors.

Hope this helps!

Try jquery-confirm. They have a variety of designs.

本文标签: jqueryBest confirm dialog JavaScript libraryStack Overflow