LoginSignup
0
0

More than 1 year has passed since last update.

【JavaScriptのメモ】OKやキャンセルのダイアログを表示する関数

Last updated at Posted at 2021-10-14

今回は、JavaScriptで使用される基礎的なダイアログを表示する関数を紹介します。

confirm()
JavaScript
confirm('文字列')

confirm()においては、戻り値が意味を持ちます。
戻り値はTrue、Falseの二種類で
OKを押せばTrueでキャンセルを押せばFalseを返す仕組みになっています。

confirm()とalert()の違いは、ボタンの数
alert()はOKだけですが、confirm()はボタンがOKとキャンセルの二つです。
prompt()はボタンがOKとキャンセルそして、テキスト入力エリアが表示されます。

0
0
0

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
0
0