<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=">
  <title></title>
</head>
<body>
  <button id="save">保存</button>
  <div id="saveResult"></div>
</body>
</html>
document.getElementById("save").onclick = function() {
  let checkSaveFlg = window.confirm('保存を実行してもよろしいですか?');
  
  if(checkSaveFlg) {
    document.getElementById("saveResult").textContent = "保存を実行しました。";
  } else {
    document.getElementById("saveResult").textContent = "保存をキャンセルしました。";
  }
};

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.