Skip to content

A beautiful replacement for JavaScript's "alert"

License

Notifications You must be signed in to change notification settings

mwakerman/sweetalert

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#SweetAlert

An awesome replacement for JavaScript's alert.

See it in action!

A success modal

#Usage

You can install SweetAlert through bower:

bower install sweetalert

Alternatively, download the package and reference the JavaScript and CSS files manually:

<script src="lib/sweet-alert.min.js"></script>
<link rel="stylesheet" type="text/css" href="lib/sweet-alert.css">

#Examples

The most basic message:

sweetAlert("Hello world!");

A message signaling an error:

sweetAlert("Oops...", "Something went wrong!", "error");

A warning message, with a function attached to the "Confirm"-button..

sweetAlert({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
}, function(){
  swal("Deleted!",
  "Your imaginary file has been deleted.",
  "success");
});

View more examples

#Related projects

About

A beautiful replacement for JavaScript's "alert"

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CSS 61.6%
  • JavaScript 38.4%