237
220

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JavaScript: いつものAlertを簡単に、少しだけおしゃれにするSweet Alert、そしてSweetAlert2

Last updated at Posted at 2021-03-14

Sweet Alert

流行っているらしいのでやってみた。
10 Trending projects on GitHub for web developers - 12th March 2021

GitHub

その後、Sweetalert2 を見つけたので、追記。// 2021/04/05

お試し

See the Pen SweetAlert by YAMADA Nobuko (@e99h2121) on CodePen.

See the Pen SweetAlert2 by YAMADA Nobuko (@e99h2121) on CodePen.

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<button type=“button” onclick="basicSample()">やさしいアラート</button>

<button type=“button” onclick="amazingSample()">すばらしいアラート</button>
function basicSample(){
  swal("きをつけてね。");
}

function amazingSample() {
  swal({
    title: "すばらしい!!",
    text: "You clicked the button!",
    icon: "success",
 });
}

自分用に使いたいときが来たらと思うメモ。

237
220
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
237
220

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?