"SweetAlert for Bootstrap"
Bootstrap 3.2.0 Snippet by lipis

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <script src="http://lipis.github.io/bootstrap-sweetalert/lib/sweet-alert.js"></script> <link rel="stylesheet" href="http://lipis.github.io/bootstrap-sweetalert/lib/sweet-alert.css"> <div class="container"> <div class="row"> <h1>SweetAlert for Bootstrap</h1> <p class="lead">For more visit the <a href="http://lipis.github.io/bootstrap-sweetalert/">lipis.github.io/bootstrap-sweetalert</a></p> <hr> <h2>Try any of those!</h2> <div class="examples"> <button class="btn btn-lg btn-primary sweet-10" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Primary']);">Primary</button> <button class="btn btn-lg btn-info sweet-11" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Info']);">Info</button> <button class="btn btn-lg btn-success sweet-12" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Success']);">Success</button> <button class="btn btn-lg btn-warning sweet-13" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Warning']);">Warning</button> <button class="btn btn-lg btn-danger sweet-14" onclick="_gaq.push(['_trackEvent', 'example, 'try', 'Danger']);">Danger</button> </div> </div> </div>
document.querySelector('.sweet-10').onclick = function(){ swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "info", showCancelButton: true, confirmButtonClass: 'btn-primary', confirmButtonText: 'Primary!' }); }; document.querySelector('.sweet-11').onclick = function(){ swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "info", showCancelButton: true, confirmButtonClass: 'btn-info', confirmButtonText: 'Info!' }); }; document.querySelector('.sweet-12').onclick = function(){ swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "success", showCancelButton: true, confirmButtonClass: 'btn-success', confirmButtonText: 'Success!' }); }; document.querySelector('.sweet-13').onclick = function(){ swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonClass: 'btn-warning', confirmButtonText: 'Warning!' }); }; document.querySelector('.sweet-14').onclick = function(){ swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "error", showCancelButton: true, confirmButtonClass: 'btn-danger', confirmButtonText: 'Danger!' }); };

Related: See More

Featured Templates


Questions / Comments:

Very nice. Congratulations.

Jefferson Ciotti () - 3 years ago - Reply 1


The script link "https://lipis.github.io/bootstrap-sweetalert/lib/sweet-alert.js" no longer exists

kounelios13 () - 1 week ago - Reply 0


why it doesn't work?

Maghfirah Suyuti () - 1 year ago - Reply 0


Little diffcult tu use but now that working :) How can i add an href on the confirm button ?

Pierre () - 1 year ago - Reply 0


i cant get it to work, any help?

njstat () - 2 years ago - Reply 0


nice...

suraj vs () - 3 years ago - Reply 0


nice

Héritier Kipaka () - 3 years ago - Reply 0


What does the sweet-10 mean?

Jay () - 3 years ago - Reply 0


how to change this alert to get it on page load? I want to show user that this part of site is only for logged users and I want use alert box to do that.

empty () - 3 years ago - Reply 0


You can use jQuery's "document ready" function to initialize the swal() function:

maxsurguy () - 3 years ago - Reply 0


awesome

Rafael Queiroz () - 3 years ago - Reply 0


Wow!

Henrique () - 3 years ago - Reply 0


What about changing the cancelButtonClass? I can't for now :(

Lloople () - 3 years ago - Reply 0


Awesome !

allaghi () - 3 years ago - Reply 0


How to use it?
It doesn't function for me

Plese, help!

Brismimo () - 3 years ago - Reply 0


What happens?

maxsurguy () - 3 years ago - Reply 0


Great!!!

Maria del Carmen () - 3 years ago - Reply 0


This is lovley!

Ian Peter Freeley () - 3 years ago - Reply 0


This is brilliant!

Talha Tanveer () - 3 years ago - Reply 0


Is this snippet working too with Bootstrap 3.3.1 (the latest version) ?

TyrionGraphiste () - 3 years ago - Reply 0