http://tristanedwards.me/sweetalert

改變瀏覽器預設 alert 對話框


  • A basic message

    swal("Here's a message!")
  • A title with a text under

    swal("Here's a message!", "It's pretty, isn't it?")
  • A success message!

    swal("Good job!", "You clicked the button!", "success")
  • A warning message, with a function attached to the "Confirm"-button

    swal({
      title: "Are you sure?",
      text: "Your will not be able to recover this imaginary file!",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55"
      confirmButtonText: "Yes, delete it!"
    },function(){
      alert("Deleted!");
    });
  • A message with a custom icon

    swal({
      title: "Sweet!",
      text: "Here's a custom image.",
      imageUrl: "images/thumbs-up.jpg"
    });
Go to top