Skip to content

Instantly share code, notes, and snippets.

@t4t5
Created September 6, 2017 14:31
Show Gist options
  • Save t4t5/69105ac83f91e2cc9b89ba839964359e to your computer and use it in GitHub Desktop.
Save t4t5/69105ac83f91e2cc9b89ba839964359e to your computer and use it in GitHub Desktop.
SweetAlert with different number of buttons
// No buttons:
swal({
text: "This modal has no buttons!",
buttons: false,
});
// 1 button:
swal({
text: "Here’s a modal with one button!",
button: "Click me!",
});
// 2 buttons:
swal({
text: "Two buttons…",
buttons: ["Cancel", "Click me!"],
});
// 3 buttons:
swal({
text: "Even three buttons, each with their own promise value!",
buttons: {
cancel: "Cancel",
confirm: "Click me!",
hello: "Say hello!",
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment