<h1>クリックした状態を保持する</h1>
<button id="button">送信する</button>
  
button {
  padding: 0.5em;
  border: 1px solid #cccccc;
  cursor:pointer;
}

const button = document.getElementById("button");
function changeFlag() {
  let flag = false;
  return () => {
    if (flag) {
      alert("送信済みです");
    } else {
      flag = true;
    }
  };
}

const click = changeFlag();
button.addEventListener("click", () => {
  click();
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.